From: kaz@ashi.FootPrints.net (Kaz Kylheku)
Subject: Re: comma operator: C compiler bug or bogus usage?
Date: 1999/04/15 [thread overview]
Message-ID: <slrn7hckqu.7lr.kaz@ashi.FootPrints.net> (raw)
In-Reply-To: 7f5fvl$ujn$1@news.iastate.edu
On 15 Apr 1999 19:51:17 GMT, John Hascall <john@iastate.edu> wrote:
>Kaz Kylheku <kaz@ashi.FootPrints.net> wrote:
>}>int bar[3,4];
>}> constant-expression comma-operator constant-expression
>}> still a constant-expression or not? If not, why not ...
>
>}It's certainly an expression with a value that can be determined at compile
>}time, no argument there. However, that is not the same as a constant
>}expression. The latter is just a term that is arbitrarily defined in the C
>}standard. You have to apply that definition to determine whether something
>}is a constnat expression or not.
>
> Ah, silly me, the Humpty-Dumpty privilege!
>
>}>John
>}>PS, FWIW, gcc accepts both of these and produces the 'expected' results
>}It does not if you tell it to be an ANSI C compiler witn -ansi -pedantic.
>
> Actually I tried it with -ansi -Wall
> but the man page scared me away from -pedantic :)
The -ansi option just means to disable GCC extensions that would cause ansi
programs to be rejected or diagnosed. The -pedantic option is needed to further
comply with ANSI C by generating required diagnostics for syntax and constraint
violations.
That (outdated) man page is just GNU propaganda: ``there is no reason to use
this option; it exists only to satisfy pedants''. This is, of course, nonsense.
The list of syntax and constraint violations required by ANSI C is not all that
extensive; to say that only a pedant would want these diagnostics is laughable.
If your compiler doesn't diagnose an ANSI C syntax or constraint violation, the
code may well be rejected by another compiler. Or the lack of diagnosis may
even cause a defect to go undetected.
You see, the FSF guys want everyone to write in GNU C, that is, using the GCC
extensions, so that the code won't compile with those evil non-freeware
compilers that nobody should be using now that there is GCC. :)
next prev parent reply other threads:[~1999-04-15 4:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-15 4:00 comma operator: C compiler bug or bogus usage? John Hascall
1999-04-15 4:00 ` Noone Really
1999-04-15 4:00 ` Kaz Kylheku
1999-04-15 4:00 ` John Hascall
1999-04-15 4:00 ` Kaz Kylheku [this message]
1999-04-16 4:00 ` Lawrence Kirby
1999-04-15 4:00 ` Casper H.S. Dik - Network Security Engineer
1999-04-15 4:00 ` Lawrence Kirby
1999-04-15 4:00 ` Joerg Czeranski
1999-04-15 4:00 ` Will Rose
1999-04-15 4:00 ` Venkat
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox