C oddity -- language and/or compiler
utzoo!decvax!harpo!eagle!mhtsa!alice!rabbit!smb
utzoo!decvax!harpo!eagle!mhtsa!alice!rabbit!smb
Wed Jan 19 10:05:38 AEST 1983
A co-worker found this one the hard way....
double a; /* Note the semi-colon! */
b,
c,
d;
main()
{
a = b;
}
On the VAX, this program was silently accepted, and b, c, and d were
assigned 4 bytes apiece. On an 11, using the Ritchie C compiler, *nothing*
was generated for b, c, and d; pcc, however, behaved the same way it did on
the VAX.
Presumably, we have some sort of bug here, since two different C compilers
are doing very different things. My take is that both are wrong; that that
construction should be flagged as a syntax error. But I'm willing to be
convinced that we've stumbled across another strange and wondrous property of
the comma operator.
Enlightenment, anybody?
--Steve Bellovin
{rabbit,mhb5b,mhb5c}!smb
More information about the Comp.lang.c
mailing list