?: syntax (was Problem with #define'd macro...)

Chris Torek torek at elf.ee.lbl.gov
Fri Apr 5 08:25:23 AEST 1991


In article <18234 at crdgw1.crd.ge.com> volpe at camelback.crd.ge.com
(Christopher R Volpe) writes:
[given	a ? b = 1 : c = 1  or equivalent]
>GCC ... with -ansi [and -pedantic] ... never finds the syntax
>violation.

True, but it does produce a diagnostic, so I think it is doing the
right thing.  It is no surprise that gcc's parser accepts the
expression: gcc uses a single yacc (well, bison) grammar and has
extensions, so it must use some other error for `-ansi -pedantic'
violations that otherwise fit its extensions (as in this case).
I am sure the standard does not require the diagnostic for the
above to be `syntax error'.  `Invalid lvalue in assignment' is
not the best error message, though.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list