C style peeve (Yo people, try reading carefully next time!)

Art Boyne boyne at hplvli.HP.COM
Fri Mar 23 08:22:47 AEST 1990


jgk at osc.COM (Joe Keane) writes:
>Here's my biggest C style peeve.  For some reason, many C programmers insist
>on always putting parentheses around return values, even when they're not
>necessary, which happens to be always.  God knows why, but they write
>`return(2+2);' instead of the obvious and K&R-approved style `return 2+2;'.

While 'return value;' is legal according to K&R1 (see page 203), *every*
example in my copy of the book uses 'return (value);'.  Pretty obvious,
therefore, why people code that way.  Also, 'while', 'for', 'if', etc.,
all *require* parenthesis, so it's a reasonable habit to acquire.

Art Boyne, boyne at hplvla.hp.com



More information about the Comp.lang.c mailing list