C
Chris Torek
(I was hoping someone else would answer this... no luck )
I think the answer to your question is "no", but I do not really
fully understand C99's "restrict".
Note that in this case, the compiler can "see" that *p is changed,
despite the "const". In my earlier example, the compiler cannot
(at least locally) see that *p is changed, even though p is declard
using "const char *p", so the compiler has to assume that the
"const" still means "changes after every subroutine call".
Although the below code is definitely poor style, is any rule actually
violated?
void f(const int *restrict p) {
*(int *) p = 0;
}
int main(void) {
int i = 1;
f(&i);
return i;
}
I think the answer to your question is "no", but I do not really
fully understand C99's "restrict".
Note that in this case, the compiler can "see" that *p is changed,
despite the "const". In my earlier example, the compiler cannot
(at least locally) see that *p is changed, even though p is declard
using "const char *p", so the compiler has to assume that the
"const" still means "changes after every subroutine call".