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: tim at wagner dot princeton dot edu
- Subject: Re: thoughts on martin's proposed patch for GCC and UTF-8
- From: Craig Burley <burley at gnu dot org>
- Date: Thu, 10 Dec 1998 14:49:30 -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
- Cc: burley at gnu dot org
>> #if defined (FOO) && (FOO == 1)
>>
>> and:
>>
>> #ifdef FOO
>> #if FOO == 1
>>
>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).
That's good to hear, and I had hoped it would be the case, but thought
I should mention it anyway.
>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.
It sounds like you're saying the only binary operators are && and
||, which doesn't sound quite right. && and || are the logical AND
and OR operators, according to my 1998-12-07 draft copy of the ANSI
C standard, and I believe the &, |, and other bitwise operators,
plus the +, -, * and / integer operators are supported for preprocessor
directives as well.
But I'm not sure this changes what you're saying.
What might, though, is the implementation. It might insist on
expanding macros beyond a short-circuit, and, if it does, you
can't just change it so that, when it replaces an undefined
macro with 0, it optionally warns.
tq vm, (burley)