Sequence points

Discussion in 'C++' started by Dave Theese, Sep 3, 2003.

  1. Dave Theese

    Dave Theese Guest

    Hello all,

    I have read the definition of a sequence point in the standard and can
    follow it mechanically, but for some reason, I'm having a hard time grasping
    the conceptual meaning and significance. Can someone out there offer good
    intuition on sequence points???

    Thank you!
    Dave
    Dave Theese, Sep 3, 2003
    #1
    1. Advertising

  2. On Tue, 2 Sep 2003 19:19:55 -0700, "Dave Theese" <> wrote:

    >I have read the definition of a sequence point in the standard and can
    >follow it mechanically, but for some reason, I'm having a hard time grasping
    >the conceptual meaning and significance. Can someone out there offer good
    >intuition on sequence points???


    Goodest intuition: you don't need to think about them if you avoid
    expressions with side-effects.

    That also generally gives much more clear code.

    Leave it to the compiler to do the trivial optimizations.
    Alf P. Steinbach, Sep 3, 2003
    #2
    1. Advertising

  3. Dave Theese wrote:
    >
    > Hello all,
    >
    > I have read the definition of a sequence point in the standard and can
    > follow it mechanically, but for some reason, I'm having a hard time grasping
    > the conceptual meaning and significance. Can someone out there offer good
    > intuition on sequence points???


    Sequence points are a somewhat artificial concept. Basically a sequencepoint
    is a spot in processing where you can be sure that every computation has finished
    and the results are where they should be. Between 2 sequencepoints the compiler
    is free to rearrange things any way it pleases him. So you cant relay on anything.
    Only after a sequencepoint is passed, it is safe to expect results where they
    should be.

    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Sep 3, 2003
    #3
    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. Timothy Madden

    Does C++ have sequence points ?

    Timothy Madden, Sep 20, 2004, in forum: C++
    Replies:
    4
    Views:
    393
    Peter van Merkerk
    Sep 21, 2004
  2. j

    Sequence points

    j, Jul 23, 2003, in forum: C Programming
    Replies:
    4
    Views:
    365
    Tak-Shing Chan
    Jul 24, 2003
  3. akarl

    Knowing your sequence points

    akarl, Aug 11, 2005, in forum: C Programming
    Replies:
    7
    Views:
    378
    Jack Klein
    Aug 12, 2005
  4. Question about sequence points

    , Aug 4, 2006, in forum: C Programming
    Replies:
    3
    Views:
    270
    Clark S. Cox III
    Aug 12, 2006
  5. Question about sequence points 2

    , Aug 4, 2006, in forum: C Programming
    Replies:
    1
    Views:
    254
Loading...

Share This Page