From: fred@genesis.demon.co.uk (Lawrence Kirby)
Subject: Re: comma operator: C compiler bug or bogus usage?
Date: 1999/04/15 [thread overview]
Message-ID: <924201978snz@genesis.demon.co.uk> (raw)
In-Reply-To: 7f567v$sp1$1@news.iastate.edu
In article <7f567v$sp1$1@news.iastate.edu>
john@iastate.edu "John Hascall" writes:
...
>It seems to me that the first error message is clearly not helpful,
>but what haven't been able to discover is:
>
> Is the result of:
>
> constant-expression comma-operator constant-expression
>
> still a constant-expression or not? If not, why not (and it
> seems to me this is the only operator with this property?)
The C standard says
"Constant expressions shall not contain assignment, increment, decrement
function-call, or comma operators, except when they are contained within
the operand of a sizeof operator."
>John
>PS, FWIW, gcc accepts both of these and produces the 'expected' results
By default the language that gcc compiles is not C, it is what is
loosely called "GNU C" which includes a numbver of extensions over
standard C. Use gcc -ansi -pedantic to make gcc an essentially standard C
compiler. If you do you should find that it warns about your code.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
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 ` Casper H.S. Dik - Network Security Engineer
1999-04-15 4:00 ` Kaz Kylheku
1999-04-15 4:00 ` John Hascall
1999-04-15 4:00 ` Kaz Kylheku
1999-04-16 4:00 ` Lawrence Kirby
1999-04-15 4:00 ` Lawrence Kirby [this message]
1999-04-15 4:00 ` Joerg Czeranski
1999-04-15 4:00 ` Will Rose
1999-04-15 4:00 ` Venkat
1999-04-15 4:00 ` Noone Really
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