When is a statement an expression?

Steve Simmons scs at vax3.iti.org
Thu Apr 27 14:34:32 AEST 1989


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 at vax3.iti.org  -- or -- ...!sharkey!itivax!scs
         "Hey...you *can* get here from here!"



More information about the Comp.lang.c mailing list