return expr and Decus-C

Dick Dunn rcd at opus.UUCP
Wed May 16 11:49:42 AEST 1984


>>	return expr;
>>	is preferable to
>>	return(expr);
>>	since the latter looks like a function call (which it is not).
>
>By this reasoning, we should use "while expr" instead of "while (expr)",
>and "if expr" instead of "if (expr)".  And don't forget "switch expr" to
>replace "switch (expr)".

Seems like a good idea to me.  (Put down that torch!  Not for C, but for
another language.)  After all, Pascal manages without the parens around the
expr's in "if", "while", and "case" (Pascal analog of "switch").  Of
course, some Pascalers are amazed that C doesn't have "then" to go with
"if".
(It's a little trickier to get rid of BOTH the parens around the expr in
the "if" AND the "then" keyword - but it's possible.  Look at the way Icon
handles comparable situations.)
-- 
...A friend of the devil is a friend of mine.		Dick Dunn
{hao,ucbvax,allegra}!nbires!rcd				(303) 444-5710 x3086



More information about the Comp.lang.c mailing list