??? 06/22/07 21:53 Read: times |
#141167 - The reason Responding to: ???'s previous message |
Russ Cooper said:
Jeff said:
What does it do? It gives any decent compiler fits, that's what it does. Please explain. I'm not enough of a language expert to understand why it's wrong. Also, what sort of warning or error message should a good compiler give for this code? -- Russ Some operators are assumed to be associative and commutative (^ is one of them). The compiler is permitted to evaluate in any order it sees fit, which if for whatever reason it decided not to evaluate right to left would give a different result than what you expect. The compiler will, or should, generate a warning message that the result is undefined, though most will evaluate the operations in the order you'd expect. Some things in C are defined as "implementation dependent" and can bite you if you're not aware of them. |