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 6697089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:25:06+00:00 2026-05-26T06:25:06+00:00

For example for such statement: c += 2, c -= 1 Is it true

  • 0

For example for such statement:

c += 2, c -= 1

Is it true that c += 2 will be always evaluated first, and c in second expression c-= 1 will always be updated value from expression c += 2?

  • 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-26T06:25:07+00:00Added an answer on May 26, 2026 at 6:25 am

    Yes, it is guaranteed by the standard, as long as that comma is a non-overloaded comma operator. Quoting n3290 §5.18:

    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)83. 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.

    And the corresponding footnote:

    83 However, an invocation of an overloaded comma operator is an ordinary function call; hence, the evaluations of its argument
    expressions are unsequenced
    relative to one another (see 1.9).

    So this holds only for the non-overloaded comma operator.

    The , between arguments to a function are not comma operators. This rule does not apply there either.

    For C++03, the situation is similar:

    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 and the value of the left expression is
    discarded. The lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) standard conver-
    sions are not applied to the left expression. All side effects (1.9) of the left expression, except for the
    destruction of temporaries (12.2), are performed before the evaluation of the right expression.
    The type and
    value of the result are the type and value of the right operand; the result is an lvalue if its right operand is.

    Restrictions are the same though: does not apply to overloaded comma operators, or function argument lists.

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

Sidebar

Related Questions

For example I have such query: Query q = sess.createQuery(from Cat cat); List cats
How to get a value from previous result row of a SELECT statement If
Given a simple statement, such as: <statement id=SelectProducts resultMap=???> SELECT * FROM Products </statement>
for example: if(cond1) if(cond2) DoCond2(); else DoCond3(); Will the else statement be considered as
For example I such a code ... get some memory and lose all the
There is an online file (such as http://www.example.com/information.asp ) I need to grab and
So I have some openGL code (such code for example) /* FUNCTION: YCamera ::
If a file system task such as a rename fails, for example if the
I would like to translate or 301-redirect urls such as: www.domain.com/example.html to www.domain.com/example Here
Greetings everybody. I have seen examples of such operations for so many times that

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.