This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7135: Faulty Operator Precedence
- From: nathan at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, lindahlb at hotmail dot com, nobody at gcc dot gnu dot org, unifex at yuidesigns dot net
- Date: 27 Jun 2002 11:14:44 -0000
- Subject: Re: c++/7135: Faulty Operator Precedence
- Reply-to: nathan at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, lindahlb at hotmail dot com, nobody at gcc dot gnu dot org, unifex at yuidesigns dot net, gcc-gnats at gcc dot gnu dot org
Synopsis: Faulty Operator Precedence
State-Changed-From-To: open->feedback
State-Changed-By: nathan
State-Changed-When: Thu Jun 27 04:14:43 2002
State-Changed-Why:
I beleive the code is ill-formed. I agree the code is
equivalent to
operator<<(operator<<(cout, a.set(5).get()), a.set(30).get());
which I'll rewrite as
Foo (Baz (cout a.Wibble (5)), a.Wobble (30)))
There are 4 sequence points in that, each between
evaluating the parameters to a call, and the call itself.
These sequence points are partially ordered, but not
completely ordered. In particular there is no ordering
between the a.Wobble (30) call and the a.Wibble (5) call.
i.e. in evaluating the argyments to Foo, I could
a.Wobble (30)
a.Wibble (5)
cout
call Baz
call Foo
I cout reorder the a.Wibble and a.Wobble calls. your example
had a.Wobble (5).Fetch1 () and a.Wibble (30).Fetch2 (),
those fetch calls are similarly unorderd. Provided the
appropriate Fetch occurs after the Wibble/Wobble call,
C++ semantics are maintained.
Let me know if you disagree with my analysis
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7135