Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* comma operator: C compiler bug or bogus usage?
@ 1999-04-15  4:00 John Hascall
  1999-04-15  4:00 ` Kaz Kylheku
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: John Hascall @ 1999-04-15  4:00 UTC (permalink / raw)


# uname -a
OSF1 pvtest.cc.iastate.edu V4.0 878 alpha

# cat ct.c
#include <stdio.h>

int foo[(3,4)];
int bar[3,4];

main(){ printf("sizes of foo and bar are %d, %d\n", sizeof(foo), sizeof(bar)); }

# cc  -g -O0 ct.c  -o ct
cc: Error: ct.c, line 4: Missing "]".
int bar[3,4];
---------^
cc: Error: ct.c, line 3: In the declaration of "foo", "3,4" is not constant, but occurs in a context that requires a constant expression.
int foo[(3,4)];
---------^

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?)

John
PS, FWIW, gcc accepts both of these and produces the 'expected' results
-- 
John Hascall, Software Engr.      Shut up, be happy.  The conveniences you
ISU Computation Center            demanded are now mandatory. -Jello Biafra
mailto:john@iastate.edu
http://www.cc.iastate.edu/staff/systems/john/index.html  <=- the usual crud



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~1999-04-16  4:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-04-15  4:00 comma operator: C compiler bug or bogus usage? John Hascall
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 ` Casper H.S. Dik - Network Security Engineer
1999-04-15  4:00 ` Joerg Czeranski
1999-04-15  4:00   ` Will Rose
1999-04-15  4:00 ` Lawrence Kirby
1999-04-15  4:00 ` Venkat
1999-04-15  4:00 ` Noone Really

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox