Sequence points

D

Dave Theese

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
 
A

Alf P. Steinbach

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.
 
K

Karl Heinz Buchegger

Dave said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top