APL\360

Sean Conner spc at conman.org
Sat Jan 30 18:37:18 CST 2021


It was thus said that the Great Bill Gunshannon via cctalk once stated:
> On 1/29/21 4:12 PM, Will Cooke via cctalk wrote:
> >
> >>On 01/29/2021 2:58 PM Fred Cisin via cctalk <cctalk at classiccmp.org> wrote:
> >>
> >
> >>'=' and '==' makes possible what is probably the most common error, and
> >>which the compiler doesn't catch:
> >>if (x = 3) . . . /* sets x to 3 and gives TRUE for the condition */
> >>I imagine that there are probably some pre-processors that would return a
> >>WARNING for it.
> >>
> >
> >Modern Visual Studio and GCC both flag the "=" in a condition, I believe.  
> >But if you're shipping code with 260+ warnings, who would see one more.
> 
> And the problem here is really quite plain and simple.
> Why are you shipping code with any warnings?

  Because sometimes they aren't.  Example:

gcc -std=c99 -g -Wall -Wextra -pedantic -fPIC -g -shared -o lib/tcc.so src/tcc.c -ltcc
src/tcc.c: In function cclua_get_symbol':
src/tcc.c:528: warning: ISO C forbids assignment between function pointer and `void *'

  ISO C may forbid that, but POSIX requires it, and I'm compiling on a POSIX
system, but there isn't (to my knowledge) a way to state that.  Yes, I could
probably surpresss that one warning, but for me, it's easier to ignore on
POSIX systems.

  Also, have you tried clang with the highest warning level?  It's useless. 
I tried it once, only to be told "warning: struct foo has padding bytes
added" (or something to that effect).  Okay, so I pack the structure, only
to get "Warning: struct foo doesn't have any padding".  Yean, real useful
that.

  -spc



More information about the cctalk mailing list