Comma Operator - Left to Right Associativity
Andreas Schwab
schwab@linux-m68k.org
Thu Feb 4 21:21:18 GMT 2021
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."
More information about the Gcc
mailing list