Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!itivax!vax3.iti.org!scs From: scs@vax3.iti.org (Steve Simmons) Newsgroups: comp.lang.c Subject: When is a statement an expression? Summary: Why isn't this a syntax error? Message-ID: <1043@itivax.iti.org> Date: 27 Apr 89 04:34:32 GMT Sender: news@itivax.iti.org Reply-To: scs@vax3.iti.org (Steve Simmons) Organization: Industrial Technology Institute Lines: 26 A friend was over tonight and we were talking over wierd C code we have written. The conversation brought up two oddies, of which this is the first. We used to use an old Altos 8086 box running v7 (never saw the commercial light of day, I think) where we wrote code like: main() { int a = 0 ; a = if ( a == 1 ) 12 ; else 14 ; printf( "Value of a is %d\n", a ) ; } We tried it out on all the C compilers we could find (BSD 4.3, Gould, UNIX-PC, gcc) and it fails. But the error messages are quite cryptic (we like gcc: "parse error after 'a'") and largely don't address the real problem. Anybody else ever use stuff like this? Steve Simmons Just another midwestern boy scs@vax3.iti.org -- or -- ...!sharkey!itivax!scs "Hey...you *can* get here from here!"