"Asger K. Alstrup Nielsen" <[EMAIL PROTECTED]> writes:
| On 9 Jan 2001, Lars Gullik Bjønnes wrote:
|
| > I will remove () that has no value when I see them.
| >
| > - two points:
| > - () without meaning kindo shows that the coder does not know the
| > precedence rules
|
| I'm sure you don't know all of them well enough to securely disambiguify
| any given C++ expression I might throw at you.
Some parts of precedence rules are more muddy than others...
|
| > - () without meaning makes the code harder to understand
|
| Look deep into your heart. You know there is meaning to the
| "superfluous" parenthesis, and Juergen is not using too many
| parentheses. He might be making lots of other bug^t^t^tfeatures, but don't
| attack him for being trigger happy with the curves.
If my comments came across as "Jürgen Bashing" then I am sorry, it
was meant as more general comment.
|
| > - () mithout meaning hides () that are really needed.
|
| Parenthesis are needed if the author feels they are needed. And then, they
| are really needed. It's as simply as that.
I do not agree.
return (5);
looks strange and seems to imply the return is a function.
| Come on, Lars. Code is for communication between humans, not machines.
| That's why we don't use binary codes.
When I see unneeded code constructs I always begin to wonder if there
are something special about this code that I don't understand.
if (ptr)
delete ptr;
is one such case.
| You should write the code such that humans can understand it,
| and that involves proactively using parenthesis when there is
| some doubt to the meaning, or you generally feel that it can improve the
| understanding.
Oh I agree, but adding parantheses instead of splitting the construct
up into two/three constructs can make code harder to parse and
understand.
| I know the precendence rules for C++ about 90%, and others know them
| 80%. You might know them 95%, but the thing is that the common ground for
| all of us might be as low as 70%. (Actually I expect it to be lower.)
If you stay with the common operators almost everybody have good
knowledge of the rules. Muddy corners are muddy corners.
But we really agree...
Lgb