Re: warning: comparison with string literal results in unspecified behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Haley wrote:
Russell Shaw wrote:
How do i disable that? My code explicitly compares string pointers.

The best way is to intern all your strings.  String interning is a
fairly common efficient technique and you can look it up in Google.

I've seen that in Xlib code. There's no reason to do it if you're
not storing strings on a remote host.

I store pointers to const strings in various objects and use them
much like magic numbers, so direct pointer comparisons are the ideal
thing to do.

This warning never happened on older gcc versions.

Infact, the warning is incorrect for this valid use.

It's just unnecessary nannying.

I've been using it in thousands of lines of code for 5 years.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux