Seebs said:
[seebs, in C:TCN]
'Parentheses are operators that increase the precedence of the
operations inside them.'"
[The above is a quotation from Schildt's book.]
[spinny]
Herb is correct. This is what parentheses do. The optimizer is
entitled to change the order of evaluation if the precedence is
preserved,
...or even if it isn't. Between consecutive sequence points, the
implementation is entitled to use any order of evaluation in likes.
But really, they haven't changed the precedence of anything. They've
grouped a subexpression.
Schildt's description, though it's badly worded, isn't necessarily
entirely wrong.
Oh thanks mighty C authority
Parentheses do have to do with precedence. Perhaps a
better way to say it is that parentheses themselves have very high
precedence.
A remarkably ignorant statement, since in accepted usage in the
computer science community, only operators can have precedence, and
parentheses are not operators.
(Of course the C standard doesn't discuss this in terms of
precedence, but it's not unreasonable to apply the concept.)
For example, in
x + y * z
"*" has higher precedence than "+"; in
(x + y) * z
"()" has higher precedence than either "+" or "*".
This makes no sense whatsoever. The parentheses are not evaluated. If
you translate the expression "(x + y) * z" to suffix notation (xy+z*)
they go away.
Operator precedence is in fact defined only for infix expressions in
the ABSENCE of parentheses, and in ordinary math and compsci, the
addition and subtraction operators have higher precedence than the
multiplication and division operators, which was based on praxis in
high school algebra. Therefore, your statement gives evidence that you
flunked high school algebra. WTF do you think you are doing at Nokia?
I'm afraid that while Schildt may have been at times confused by an
artifact which was incompetently designed, your discussion, Mr.
Thompson, exhibits a frightening lack of comprehension of the
scientific basis of your profession.
It is remarkable how foully people who misuse "terminology" are
treated here by people who in Seebach's case, lack, and exhibit lack
of, computer science education, and in your case also eshibit this
lack.
During the later part of my programming career, earlier in this
decade, I noticed that actual programmers and their managers were
forever finding excuses not to program in the USA. This was because
for years, management had dismissed the scientific theory in favor of
snake oil, and it was confirmed by articles in the New York Times:
that most American programmers simply do not code much. They attend
meetings, they read and write "white papers", those famous documents,
carefully purged of critical thought, with a subtly racist name.
They occasionally change a line of code and almost as often get it
wrong. They write shell procedures or vanity C with unnecessarily
unstructured fallthrough.
They spend hours gossiping and backbiting, online and in meatspace,
and on the phone to real estate brokers.
When they are laid off, nothing much happens apart from the stock
price increase because all the work is being done by my former
coworkers in Shenzen, and in India.
Anyone who can say with a straight face that parentheses have
precedence is a clown.
And anyone who mounts a fifteen year campaign of personal destruction
against a harmless computer author is an evil clown.
I see another comp.risks submission: the RISKS of programmer
incompetence. Don't worry, I won't name names, whether of individuals
or companies. But part of my article will be based on what I've seen
here.
However, at this time, I have taken a break to write a Shakespearean
play about the British election, "The Well-Hung Election, or, Brown
Goeth Down to China Town". I am applying what I know about prosody.
People here are welcome to read it at
http://spinoza1111.wordpress.com/20...ive-and-well-if-rather-shady-in-london-today/.
Here's a sample:
Brown: Varlet, scum, Nancy boy, loser,
And whatever other name may not unbecome
My high and palmy state, tho’ it be thus destroy’d
(For even as men remember’d Rome they will bewail
The loss of New Labour and its grand design)
Be thou call’d. Out of my sight! Thou dost infect mine eyes:
You incompetent Piece of Matter Fecal,
You toad-eating scum of the green-mantl’d Pond,
You block, you stone, you worse than senseless thing,
Thou hast stol’n the election and I am no longer King.
Aide Secundus:What, King? Thou weren’t elected
But King thou never wert, or my name is Bert