I’ve read the essay Surviving the Release Version.
Under the “Aliasing bugs” clause it says:
You can get tighter code if you tell
the compiler that it can assume no
aliasing….
I’ve also read Aliasing (computing).
What exactly is a variable alias? I understand it means using a pointer to a variable is an alias, but, how/why does it affect badly, or in other words – why telling the compiler that it can assume no aliasing would get me a “tighter code”
Disallowing aliasing means if you have a pointer
char* b, you can assume that b is the only pointer in the program that points to that particular memory location, which means the only time that memory location is going to change is when the programmer usesbto change it. The generated assembly thus doesn’t need to reload the memory pointed to bybinto a register as long as the compiler knows nothing has usedbto modify it. If aliasing is allowed it’s possible there’s another pointerchar* c = b;that was used elsewhere to mess with that memory