This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: thoughts on martin's proposed patch for GCC and UTF-8
- To: burley at gnu dot org (Craig Burley)
- Subject: Re: thoughts on martin's proposed patch for GCC and UTF-8
- From: Tim Hollebeek <tim at wagner dot princeton dot edu>
- Date: Thu, 10 Dec 1998 13:19:48 -0500 (EST)
- Cc: eggert at twinsun dot com, martin at mira dot isdn dot cs dot tu-berlin dot de, brolley at cygnus dot com, gcc2 at gnu dot org, egcs at cygnus dot com, burley at gnu dot org
Craig Burley writes ...
>
> >gcc really should complain "undeclared identifier 'x' in preprocessor
> >conditional expression has value 0" when -Wall is specified. Only
> >BASIC and perl programmers, and Fortran programmers who don't use
> >"implicit none", should have to worry about creating new variables
> >every time they make a typo.
>
> Long a pet peeve of mine as well, though I wonder if fixing this might
> cause gcc to warn about too many constructs like
>
> #if defined (FOO) && (FOO == 1)
>
> and:
>
> #ifdef FOO
> #if FOO == 1
>
> The warning could be made smart enough to avoid most, maybe all, such
> spurious warnings.
>
> If not all, the documentation should be pretty clear about what to
> do, and what to not bother doing, to eliminate the warnings.
Good points. The second isn't a problem, though, since if FOO isn't
defined, we're skipping when we see #if, and don't need too parse the
expression. In fact, if I remember correctly, ANSI forbids parsing of
the expression (other than recognizing pp-tokens).
The first case is more important, and one I hadn't thought of.
However, the boolean operators that short circuit are the only ones
that don't use one operand, so it seems consistent with C to not
evaluate (and hence not warn about) arguments that are short
circuited. I believe this isn't ad hoc, and avoids all spurious
warnings in a consistent manner.
---------------------------------------------------------------------------
Tim Hollebeek | "Everything above is a true
email: tim@wfn-shop.princeton.edu | statement, for sufficiently
URL: http://wfn-shop.princeton.edu/~tim | false values of true."