Unnecessary parenthesis
00704a-Liber
nevin1 at ihlpf.ATT.COM
Sat Jul 9 09:02:40 AEST 1988
In article <2550075 at hpisod2.HP.COM> decot at hpisod2.HP.COM (Dave Decot) writes:
|> 3) The programmer has gotten used to putting parentheses around just about
|> everything.
|That may be true in your case, but it's a bug in the language design.
If it is truly a bug, how would you propose fixing it?
|Parentheses are overloaded for all of the following distinct purposes:
| function calls
| if, while, and do-while statements
| casts
| type construction (used both to indicate functions and for grouping)
| function declarations
| evaluation order grouping
Since 'return' can return an expression, parentheses are always allowed
(but never required). Does it really matter whether they are there or not?
Is it really any harder to understand a program that has them vs. one that
does not?
|I see no reason to add further confusion by making flow control look like
|a function call. I use "return e;" because it's less cluttered and more
|distinct.
For the case of a constant or a single variable, I do too. But on those
few occasions that I have to return an expression (instead of using a tmp
variable and returning that), I sometimes put parentheses around the
expression.
If it makes it easier to read, then put them in. Otherwise, (as long as it
doesn't make it harder to read), it really shouldn't matter.
--
_ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194
' ) ) You are in a maze of little twisty
/ / _ , __o ____ email paths, all different.
/ (_</_\/ <__/ / <_ These are solely MY opinions, not AT&T's, blah blah blah
More information about the Comp.lang.c
mailing list