Re:GCC 6.1 Released
by jcranmer on Wednesday April 27, 2016 @04:37PM
(#11584316)
There is a very important bit of strict aliasing that your statement misses. Yes, char* and unsigned char* can be used to access any lvalue. However, only signed/unsigned char* can be used to access a signed/unsigned char array. (Strict aliasing is defined via the dynamic type of an object, not which alias pairs are necessarily must-not-alias. Symmetry is not inherent, and in the case of char*, it is indeed not present).
[ Parent
| on HN ]
Re:GCC 6.1 Released
by netheril96 on Wednesday April 27, 2016 @09:02PM
(#11585903)
When you write custom memory allocator, you request memory with `malloc` or `mmap` first. The return value of those functions are raw storage, not objects with dynamic type of character array. Neither is the return value of you custom `allocate`. Strict aliasing rule does not apply.