Question regarding sequence point in case of conditional operator

Discussion in 'C Programming' started by somenath, Dec 14, 2007.

  1. somenath

    somenath Guest

    Hi All,

    I have one question regarding the conditional operator.
    In the draft C99 standard it is mentioned that

    "1 The following are the sequence points described in 5.1.2.3:
    -- The call to a function, after the arguments have been evaluated
    (6.5.2.2).
    -- The end of the first operand of the following operators: logical AND
    && (6.5.13);
    logical OR || (6.5.14); conditional ? (6.5.15); comma , (6.5.17)."

    My question is conditional operator consist of "?" and ":" . Now
    if I try to modify the value of one particular variable between "?"
    and ": " will it show undefined behavior?
    For example

    b = (a++)? a++: a++;
    Here is the second increment of a++ will be undefined?

    Regards,
    Somenath
     
    somenath, Dec 14, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alec S.
    Replies:
    10
    Views:
    10,228
    Alec S.
    Apr 16, 2005
  2. Gene

    Sequence point question

    Gene, Jun 23, 2007, in forum: C Programming
    Replies:
    5
    Views:
    280
  3. somenath

    Question regarding sequence point

    somenath, Nov 26, 2007, in forum: C Programming
    Replies:
    4
    Views:
    305
    santosh
    Nov 26, 2007
  4. somenath
    Replies:
    4
    Views:
    310
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,374
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page