This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: thoughts on martin's proposed patch for GCC and UTF-8


Paul Eggert writes ...
> 
> Really?  Suppose I write the preprocessor line
> 
> #if X == 1
> 
> where X is some Japanese identifier, but I make the understandable
> mistake of using a FULLWIDTH DIGIT ONE (code FF11) instead of an ASCII 1.
> What you're saying is that the preprocessor is obliged to treat this
> line as if it were
> 
> #if X == 0
> 
> because undeclared preprocessor identifiers default to zero?

IMO, the problem here has nothing to do with Japanese, and everything
to do with the fact that this rule is error prone in general.  I've
been meaning to implement -Wpreprocessor-undeclared for a while now.

In fact, there is an instance of a typo in the SGI standard header
files which has never been caught by any ANSI C compiler because if
this "undeclared macro == 0" rule, despite the fact that the rule only
exists to support source files which predate the existence of #ifdef.

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.

---------------------------------------------------------------------------
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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]