This is the mail archive of the
mailing list for the GCC project.
Re: C++ order of evaluation of operands, arguments
- From: Jason Merrill <jason at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, Andrew Haley <aph at redhat dot com>, GCC <gcc at gcc dot gnu dot org>
- Date: Sun, 29 Nov 2015 12:00:07 -0500
- Subject: Re: C++ order of evaluation of operands, arguments
- Authentication-results: sourceware.org; auth=none
- References: <56539AD0 dot 80905 at redhat dot com> <56543423 dot 2010707 at redhat dot com> <5655FD37 dot 60101 at gmail dot com>
On 11/25/2015 01:25 PM, Martin Sebor wrote:
On 11/24/2015 02:55 AM, Andrew Haley wrote:
On 23/11/15 23:01, Jason Merrill wrote:
There's a proposal working through the C++ committee to define the order
of evaluation of subexpressions that previously had unspecified
I agree with much of this, but was concerned about the proposal to
define order of evaluation of function arguments as left-to-right, since
GCC does right-to-left on PUSH_ARGS_REVERSED targets, including x86_64.
Not about PUSH_ARGS_REVERSED targets, but my two-penn'orth:
The proposal seems to be a bit of a minefield. This one:
a(b, c, d)
is a bit counter-intuitive. I wouldn't expect a to be evaluated before
the arg list. I wonder how many C++ programmers would.
The motivating example in the paper suggests that many C++
programmers expect a left to right order of evaluation here
due to the commonality of constructs like chains of calls.
Yes, although chains of calls like
are covered by the "a.b" bullet. The above bullet would be more
relevant to a chain like