[Bug c/82272] RFE: request a warning for (<nonbool> == <bool>) etc.
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 7 22:29:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82272
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I should point out that expanding to the tokens 0 and 1 for C does not in
any way prevent warning (it's a perfectly reasonable optional style
warning); you could for example have the preprocessor specially mark the
macros true and false when defined in stdbool.h in a system include
directory, and then specially mark tokens resulting from their expansions
so that the compiler can warn for dubious comparisons. So, whether or not
the standard should require those exact token expansions, the standard
does not prevent such warnings, though it may make them more complicated
to implement.
More information about the Gcc-bugs
mailing list