This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: folding STRING_CST + INTEGER_CST


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]