This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ Evaluation Order
- To: "Marc A. Lepage" <mlepage at molecularmining dot com>
- Subject: Re: C++ Evaluation Order
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 20 Dec 2000 02:12:10 +0100
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <3A3FC48C.1E6E1CF8@molecularmining.com>
"Marc A. Lepage" <mlepage@molecularmining.com> writes:
[...]
| My understanding is that pFoo->getIdentifier() should be called before
| pFoo.release().
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.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com