5 ms·
If I remember correctly, the C99 standard forbids pointer aliasing. That means if you use a C99-standard-conform compiler, it will automatically assume that you
by Shugyousha 12y ago
If I remember correctly, the C99 standard forbids pointer aliasing. That means if you use a C99-standard-conform compiler, it will automatically assume that you do not alias any pointers (and produce more efficient code). Making sure that you actually do NOT alias any pointers is up to the programmer of course (there exist compiler warning options that can detect such aliasing though)...
- readerrrr 12y agoYou may not alias incompatible types. In the example every type passed in the function is the same. Float. Those types are compatible( every type is to itself ) and may alias. Therefore the need to use restrict.
- DannyBee 12y ago"If I remember correctly, the C99 standard forbids pointer aliasing. " No, it doesn't :) It forbids some forms of type casting if they are later dereferenced, but that's not really the same.