This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: folding STRING_CST + INTEGER_CST
- From: Chris Lattner <sabre at nondot dot org>
- To: Tim Hollebeek <tim at hollebeek dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 25 Jun 2002 15:26:30 -0500 (CDT)
- Subject: 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/