C++ Evaluation Order
Gabriel Dos Reis
Tue Dec 19 17:12:00 GMT 2000
"Marc A. Lepage" <firstname.lastname@example.org> writes:
| My understanding is that pFoo->getIdentifier() should be called before
I disagree with that understanding.
The Standard says 5/4:
Except where noted, the order of evaluation of operands of
individual operators and subexpressions of individual expressions,
and the order in which side effects take place, is unspecified. [...]
Furthermore, 5.2.2/8 says:
[...] The order of evaluation of the postfix expression and the
argument expression list is unpecified.
So it appears that GCC's behaviour is permitted and the problem is
in your code relying on a particular order of evaluation.
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-bugs