Re:Pitfalls in C and C++: Unsigned Types (2011)
by dllthomas on Thursday September 26, 2013 @03:09AM
(#6449321)
"Typical PC hardware", at least in my recent experience, has sizeof(int) == 4, sizeof(char*) == 8 and so the reason they're different should be apparent. I believe you are correct that there is no difference when they are equal.
Isn't it equivalent to
, which should be equivalent to On typical PC hardware with sizeof(int) == sizeof(char *) that looks like a undefined behavior case to me (maybe barring border conditions; I don't feel like thinking of all edge cases). Most C compilers choose the fastest possible path for undefined behavior cases, so I would expect this to (typically. Again, there will be border cases) be equivalent to arr[-1].(See also http://stackoverflow.com/questions/2578455/pointer-arithmeti...)