Note: I'm using the objective C compiler that ships with the latest version of Xcode.
Why is it that this is legal:
void verySpecial(const float* __restrict foo, const int size) {
for (int i = 0; i < size; ++i) {
// ... do special things ...
++foo; // <-- Should be illegal to modify const pointer?
}
}
However, if I use a typedef, it does what I think it should do.
typedef float* __restrict RFloatPtr;
void verySpecial(const RFloatPtr foo, const int size) {
for (int i = 0; i < size; ++i) {
// ... do special things ...
++foo; // <-- Now this is a compiler error.
}
}
So, what is different in the typedef'd case, and what don't I understand? Reading about __restrict makes my brain hurt, and I'm not even sure it matters here.