warning: comparison with string literal results in unspecified behaviour

Russell Shaw rjshaw@netspace.net.au
Tue Jan 22 13:31:00 GMT 2008


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. I'll change to some kind of internment thing. Thanks for
the help.



More information about the Gcc-help mailing list