https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44179

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #4 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Zack Weinberg from comment #3)
> See
> http://codesearch.debian.net/
> search?q=filetype%3Ac+%5Cbsizeof%5Cs*%5C%28%5Cs*%27&literal=0 for many
> examples.

There is a lot in there where a warning would be useful, but also a lot in
there where a warning would not be useful because the only reason the code is
doing sizeof('x') is because it's making sure that it actually is sizeof(int),
to check that it's not being compiled with a C++ compiler, or a C compiler that
picked up some C++isms by mistake. If GCC decides to warn about that, it is not
obvious how the code should be rewritten to silence the warning, but still have
the desired effect. In other places, redundant parentheses can be added to
indicate that a use is intentional ("if (a = b)" warns, "if ((a = b))" shuts up
the compiler), but sizeof('x') already has redundant parentheses. Would users
then be suggested to write sizeof(('x'))?

Reply via email to