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

Re: libc6-dev and "-pedantic -O" warnings



Kirk Hilliard <kirk@ghoti.com> writes:

>   $ gcc -pedantic -O toupper.c
>   toupper.c: In function `main':
>   toupper.c:5: warning: ANSI C forbids braced-groups within expressions
>   $

> Is this a bug, or can we no longer expect well written code to compile
> warning free when optimizing?

The libraries (and in particular, the headers) use non-ANSI-C features
that are supported by gcc, if possible, but if you then use -pedantic,
you'll get warnings about these features from the compiler.  The
-pendantic is designed primarily to be used with the -ansi switch.
The gcc docs recommend *against* using -pedantic.  If you want full
warnings, use -Wall, not -pedantic.

  $ gcc -O2 -Wall toupper.c
  $

The moral of the story is, -pedantic is probably not the switch you
wanted.

cheers
-- 
Chris Waters   xtifr@dsp.net | I have a truly elegant proof of the
      or    xtifr@debian.org | above, but it is too long to fit into
http://www.dsp.net/xtifr     | this .signature file.


Reply to: