Is it legal to assign a restricted pointer to another pointer, and use the second pointer to modify the value?
问题 Does the following method respect the "restrict" contract? void fun(int* restrict foo) { int* bar = foo + 32; for (int i = 0; i < 32; ++i) *bar = 0; } My guess is no, but I need some clarification. 回答1: Yes, it sure respects the contract. 6.7.3 Type qualifiers 8 An object that is accessed through a restrict -qualified pointer has a special association with that pointer. This association, defined in 6.7.3.1 below, requires that all accesses to that object use, directly or indirectly, the value