"Semicolons and Statements"

Rich A. Hammond hammond at petrus.UUCP
Sat Nov 2 09:24:57 AEST 1985


> Jeff Siegal comments:
> ...  With the statement separator model (Algol, Pascal),
> one is free on insert or remove semi's at the end of the last statement
> of a block with both forms being syntactically correct.  This does not
> work with the statement terminator model (C).
>  ...

On the other hand, in the statement terminator model it is OK
to insert an else clause  (or remove it) without mucking with the
controlled statement.  This is not true in a statement separator
model.  This is a major source of my mistakes in PASCAL.
e.g.	terminator		separator
	if (c == d)		if ( c = d ) then
		a = b;			a = b ;
becomes
	if (c == d)		if ( c = d ) then
		a = b;			a = b 	{ remove semicolon for else }
	else			else
		e = f;			e = f;
Rich Hammond, Bellcore	(ihnp4|allegra|ucbvax)!bellcore!hammond



More information about the Comp.lang.c mailing list