This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ Evaluation Order


"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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]