This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ order of evaluation of operands, arguments
- From: Andrew Haley <aph at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, GCC <gcc at gcc dot gnu dot org>
- Date: Tue, 24 Nov 2015 09:55:47 +0000
- Subject: Re: C++ order of evaluation of operands, arguments
- Authentication-results: sourceware.org; auth=none
- References: <56539AD0 dot 80905 at redhat dot com>
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 ordering:
>
> http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2015/p0145r0.pdf
>
> 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.
>
> Any thoughts?
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.
In addition, I don't see anything about C compatibility here. It
would be very confusing, to say the least, if this were to be defined
in C++ but not C.
Andrew.