Hacker News new | past | comments | ask | show | jobs | submit login

The issue is that C does not work that way on modern machines. Not that old Alpha machines had doubleword aligned pointer and no byte or word load instructions. So indexes into the array had to be multiples of 4. More important, aliasing rules preclude treating memory like one big array: https://gist.github.com/shafik/848ae25ee209f698763cffee272a5.... C99 and newer go to some lengths to permit the optimizer for treat pointers as pointing into disjoint byte ranges (which allows the optimizer to assume they cannot alias). Accordingly the mental model of a big array of memory is, at least for C, generally unsound.



Nitpick: The same rules were also present in C89.


Thanks for the correction!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: