When is a statement an expression?
Tony Olekshy
tony at oha.UUCP
Sat May 6 18:27:41 AEST 1989
In <1043 at itivax.iti.org>, Steve Simmons (scs at vax3.iti.org) writes...
>
> main() { int a = 0 ; a = if ( a == 1 ) 12 ; else 14 ; }
>
> 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...
Well, well, well, if anyone praised the Xenix C compiler I would be the
first to provide lists of bugs, but I tried the above (too tired to party)
and cc said:
@test.c(1) : error 59: syntax error : 'if'
@test.c(1) : error 59: syntax error : 'constant'
@test.c(1) : error 59: syntax error : 'else'
Sounds right to me.
Yours, etc., Tony Olekshy (...!alberta!oha!tony or tony at oha.UUCP).
More information about the Comp.lang.c
mailing list