warning: comparison with string literal results in unspecified behaviour

Andrew Haley aph@redhat.com
Tue Jan 22 13:45:00 GMT 2008


Russell Shaw wrote:
> Russell Shaw wrote:
>> Russell Shaw wrote:
>>> Andrew Haley wrote:
>>>> Russell Shaw wrote:
>>>>> Andrew Haley wrote:
>>>>>> Russell Shaw wrote:
>>>>>>> How do i disable that? My code explicitly compares string pointers.
> 
> ...
> 
>> Scrap that example. ob3->magic == MAGIC is two separate strings.
> 
> My code is full of that problem and has been relying on gcc combining
> identical strings into one address. It has worked, but probably isn't
> guaranteed.

It definitely isn't guaranteed.  :-)

> I'll change to some kind of internment thing. Thanks for
> the help.

Cool, good luck.

Andrew.



More information about the Gcc-help mailing list