public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: David Brown <david.brown@hesbynett.no>
Cc: AJ D <aatsnps@gmail.com>,  gcc@gcc.gnu.org
Subject: Re: Comma Operator - Left to Right Associativity
Date: Thu, 04 Feb 2021 22:21:18 +0100	[thread overview]
Message-ID: <87v9b7v8a9.fsf@igel.home> (raw)
In-Reply-To: <59add9a1-ef9b-1cde-a4b7-66a167595a6b@hesbynett.no> (David Brown's message of "Thu, 4 Feb 2021 21:58:33 +0100")

On Feb 04 2021, David Brown wrote:

> For the built-in comma operator, you get guaranteed order of evaluation
> (or more precisely, guaranteed order of visible side-effects).  But for
> a user-defined comma operator, you do not - until C++17, which has
> guaranteed evaluation ordering in some circumstances.

But not the evaluation order of function arguments.  See
<https://en.cppreference.com/w/cpp/language/eval_order> Sequenced-before
rules, rule 15.

> Try your test again with "-std=c++17" or "-std=g++17" - if the order is
> still reversed, it's a gcc bug (AFAICS).

I don't think so.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  reply	other threads:[~2021-02-04 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 20:08 AJ D
2021-02-04 20:58 ` David Brown
2021-02-04 21:21   ` Andreas Schwab [this message]
2021-02-04 21:33     ` David Brown
2021-02-04 22:46       ` AJ D
2021-02-04 22:51         ` AJ D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9b7v8a9.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=aatsnps@gmail.com \
    --cc=david.brown@hesbynett.no \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).