folding STRING_CST + INTEGER_CST

Chris Lattner sabre@nondot.org
Tue Jun 25 15:50:00 GMT 2002


Tim Hollebeek said:
> Isn't it guaranteed that: strstr("hello"+3, "lo") != "lo" ?

No.  The C standard allows (but does not require) the compiler to 
"recycle" memory for string contents, allowing them to overlap.  Thus it's 
possible that:

  ("hello"+3 == "lo")

-Chris

http://www.nondot.org/~sabre/os/
http://www.nondot.org/~sabre/Projects/



More information about the Gcc mailing list