C style peeve and knowing the rules

Steve Summit scs at athena.mit.edu
Mon Mar 26 12:37:58 AEST 1990


I stopped using parentheses after "return" because I happen to
mistype that particular keyword a lot, and

	retunr x;

is a compile-time error, while

	retunr(x);

doesn't complain until link time.  Admittedly a minuscule point.

(Note, by the way, that K&R I says, on page 23, that

	The value... is returned... by the return statement...
	Any expression may occur within the parentheses.

This initially led me to believe that the parentheses were
required, as others have mentioned they once were; which may
account for the misleading wording.  It's been corrected in the
second edition, to "Any expression may follow return.")



More information about the Comp.lang.c mailing list