Re: lvalue with increment operators

Discussion in 'C++' started by Victor Bazarov, Jul 8, 2003.

  1. "srinivas reddy" <> wrote...
    > So when I say x++, does this sequence get executed?
    > t = x;
    > x += 1;
    > return t;


    For 'int' and other integral types, yes. Without the sequence
    points, though.

    >
    > tia,
    > Srinivas
    >
    > "Ron Natalie" <> wrote in message

    news:<3f09b27f$0$11827$>...
    > > "Count Dracula" <> wrote in message

    news:becbdh$16a$...
    > > > In Message-ID: <>
    > > > (srinivas reddy):
    > > >
    > > > > Assuming that x is an int, why int* p = &++x is legal and int* p =
    > > > > &x++ or int* p = &(x++) is illegal.
    > > >
    > > > All three are illegal. For the unary operator &, an lvalue
    > > > is needed, and neither x++ nor ++x is an lvalue.
    > > >

    > > ++x IS an lvalue.
     
    Victor Bazarov, Jul 8, 2003
    #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. srinivas reddy

    lvalue with increment operators

    srinivas reddy, Jul 7, 2003, in forum: C++
    Replies:
    1
    Views:
    416
    Victor Bazarov
    Jul 7, 2003
  2. Count Dracula

    Re: lvalue with increment operators

    Count Dracula, Jul 13, 2003, in forum: C++
    Replies:
    1
    Views:
    391
    Victor Bazarov
    Jul 13, 2003
  3. Kavya
    Replies:
    9
    Views:
    541
    Dik T. Winter
    Oct 28, 2006
  4. Replies:
    11
    Views:
    715
    James Kuyper
    Sep 22, 2008
  5. Julian Mehnle
    Replies:
    0
    Views:
    258
    Julian Mehnle
    Jul 17, 2003
Loading...

Share This Page