Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:31:01+00:00 2026-05-26T07:31:01+00:00

The comma operator guarantees left-to-right evaluation order. [n3290: 5.18/1] : The comma operator groups

  • 0

The comma operator guarantees left-to-right evaluation order.

[n3290: 5.18/1]: The comma operator groups left-to-right.

expression:
   assignment-expression
   expression , assignment-expression

A pair of expressions separated by a comma is evaluated left-to-right;
the left expression is a discarded value expression (Clause 5). Every
value computation and side effect associated with the left expression
is sequenced before every value computation and side effect associated
with the right expression.
The type and value of the result are the
type and value of the right operand; the result is of the same value
category as its right operand, and is a bit-field if its right operand
is a glvalue and a bit-field.

The only other clause regarding the operator doesn’t mention evaluation order. So it would appear that this is still the case when the operator has been overloaded.

But then, further up, in the general spiel regarding expressions, of course it is stated that the rules change when you overload operators:

[n3290: 5/2]: [ Note: Operators can be overloaded, that is, given
meaning when applied to expressions of class type (Clause 9) or
enumeration type (7.2). Uses of overloaded operators are transformed
into function calls as described in 13.5. Overloaded operators obey
the rules for syntax specified in Clause 5, but the requirements of
operand type, value category, and evaluation order are replaced by the
rules for function call.
Relations between operators, such as ++a
meaning a+=1, are not guaranteed for overloaded operators (13.5), and
are not guaranteed for operands of type bool. —end note ]

However, this is non-normative text. Is there any normative text defining this rule, or could a compliant compiler ignore it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:31:01+00:00Added an answer on May 26, 2026 at 7:31 am

    I only have the 03 standard to hand, but in it 5/3 says “Clause 5 defines the effects of operators when applied to types for which they have not been overloaded.”

    So all of clause 5, including 5.18/1, only applies to the built-in operators and not to any overloaded function.

    (A compliant compiler could always evaluate the operands to an overloaded operator ,() left to right though.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The C++ comma operator is used to chain individual expressions, yielding the value of
Why is the expression specified inside a comma operator (such as the example below)
MDN claims that: The comma operator evaluates both of its operands (from left to
I read this question about the comma operator in expressions ( , ) and
How does the comma operator work in C++? For instance, if I do: a
is it possible to construct variadic arguments for function by overloading operator comma of
I have a comma separated list of strings like the one below. a,b ,c
If I have a comma separated file like the following: foo,bar,n ,a,bc,d one,two,three ,a,bc,d
I got this comma separated file with a bunch of numbers The only thing
How to check for comma separated values in a text box and raise an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.