C style peeve and knowing the rules

Robert J. Drabek robert at cs.arizona.edu
Sun Mar 25 14:12:08 AEST 1990


In article <340018 at hplvli.HP.COM>, boyne at hplvli.HP.COM (Art Boyne) writes:
> 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
> 
> Also, 'while', 'for', 'if', etc.,
> all *require* parenthesis, so it's a reasonable habit to acquire.

But as Joe Keane said, these constructs require the parenthesis for a
particular reason and few people understand that reason.

Also, Joe Keane made the point that many people put parenthesis in
simply because they see other people do it.  And there are those who
believe return is a function and hence required!

I require my students to use the absolute minimum number of parenthesis
until they have ALL the rules down pat.  After leaving my courses (or in
the privacy of their own PC) they'll do whatever feels good, but I will
have done my job as well as I can by getting them to understand these
details.

Please, I know parenthesis are sometimes an aid in producing readable
code and they are also clutter which can make for less-readable code.
-- 
Robert J. Drabek                            robert at cs.Arizona.EDU
Department of Computer Science              uunet!arizona!robert
The University of Arizona                   602 621 4326
Tucson, AZ  85721



More information about the Comp.lang.c mailing list