Subtle C's

Dave Martindale dmmartindale at watcgl.UUCP
Mon Apr 23 08:51:15 AEST 1984


		From: lwe3207 at acf4.UUCP
		Message-ID: <13900003 at acf4.UUCP>
		Date: Sat, 21-Apr-84 18:30:00 EST

		Another subtle non-equivalence:

			while (a) if (b) foo; else bar;

		is not a syntax error, but is not equal to

			while (a) { if (b) foo; else bar; }


1) If they aren't equivalent, what *is* the first one equivalent to?

2) Please tell us what compiler you are using when you make statements
   such as this.

For the record, the 4.2BSD PCC-based compiler *does* treat the two
statements as equivalent, and I cannot see any other interpretation
allowed by the language.  The "else" must be part of the if statement.



More information about the Comp.lang.c mailing list