Statement terminators

N Landsberg npl at kaiser.UUCP
Thu May 11 03:01:49 AEST 1989


Regarding the original thoughts about not requiring ';' at the end
of a line, consider the following:
	/* code fragment begins */
	for(p=begin;p->p_next;p=p->p_next) /* DO NOTHING */ ;
	{ /* <---- note!!! */
		/* declarations */
		/* do something */
	}
	/* end of code fragment */
Without the trailing ';' it is unclear whether the block is to be
executed as part of the loop.  While it is possible to make the
loop unambigious by moving the assignment into a statement in the
loop body, my point is that the above is perfectly valid C and
by implying that end-of-line is statement terminator AND then
leaving off the trailing ';' you open up a whole new set of
latent bugs to track down.



More information about the Comp.lang.c mailing list