Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!news.cs.indiana.edu!att!ucbvax!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: ?: syntax (was Problem with #define'd macro...) Message-ID: <11807@dog.ee.lbl.gov> Date: 4 Apr 91 22:25:23 GMT References: <18146@crdgw1.crd.ge.com> <18200@crdgw1.crd.ge.com> <10903@ncar.ucar.edu> <18234@crdgw1.crd.ge.com> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 17 X-Local-Date: Thu, 4 Apr 91 14:25:23 PST In article <18234@crdgw1.crd.ge.com> volpe@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@ee.lbl.gov