11-08-2008, 02:14 PM
The C language DOESN'T define the order of evaluation of operands except in some circumstances (see paragraph 3 of Section 6.3 of the (C90) standard).
The standard DOES state that the precedence and associativity of operators are defined by the grammar (Section 6.3 footnote 35).
The actual order in which the compiler performs evaluations isn't specified but the result MUST, for all operand values, be the same as if the operations had been performed in accordance with the precedence and associativity rules.
I therefore think that I incorrectly asserted a left to right order.
u16a + u16b + u32c
is subject to unspecifed behaviour, and may compute the left-most addition in either 16 bit or 32 bit on a 16 bit machine.
The standard DOES state that the precedence and associativity of operators are defined by the grammar (Section 6.3 footnote 35).
The actual order in which the compiler performs evaluations isn't specified but the result MUST, for all operand values, be the same as if the operations had been performed in accordance with the precedence and associativity rules.
I therefore think that I incorrectly asserted a left to right order.
u16a + u16b + u32c
is subject to unspecifed behaviour, and may compute the left-most addition in either 16 bit or 32 bit on a 16 bit machine.