Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++11 without sequence point?

Wikipedia says that sequence points are deprecated in C++11. What does that mean? Does that mean that undefined behaviors due to sequence points has no effects?

like image 944
yesraaj Avatar asked Apr 07 '10 07:04

yesraaj


People also ask

Is comma a sequence point in C?

In C, sequence points occur in the following places. Between evaluation of the left and right operands of the && (logical AND), || (logical OR) (as part of short-circuit evaluation), and comma operators.

Is comma a sequence point?

The comma operator has the lowest precedence of any C operator, and acts as a sequence point.

What is a sequence in C?

The C language defines the following sequence points: Left operand of the logical-AND operator (&&). The left operand of the logical-AND operator is completely evaluated and all side effects complete before continuing. If the left operand evaluates to false (0), the other operand is not evaluated.

What is sequence point in C++?

Sequence point rules (until C++11) A sequence point is a point in the execution sequence where all side effects from the previous evaluations in the sequence are complete, and no side effects of the subsequent evaluations started.


3 Answers

One major problem with the term "sequence point" is that it suggests a type of absolute sequencing which never existed. Consider the expression a = (b(),c()) + d(); There is a sequence point between b() and c(), but that doesn't mean everything else can be described as being clearly before c() or being clearly after b(). It would be possible for b(), c(), and d(), to be evaludated in the order bcd, bdc, or dbc. The "sequence" point terminology didn't really make that clear, but the newer terminology does.

like image 116
supercat Avatar answered Oct 07 '22 14:10

supercat


The term "sequence point" is deprecated in order to provide a clearer explanation. The C++ language should not change.

You can find more information here

like image 43
J. Calleja Avatar answered Oct 07 '22 15:10

J. Calleja


The phrase "sequence point" has been deprecated in favor of more explicit phrasing like "sequenced before". Sequence points were difficult to understand already. Adding multithreading make them almost impossible for anybody to deal with, so they were (at least mostly) eliminated in favor of other wording.

like image 8
Jerry Coffin Avatar answered Oct 07 '22 13:10

Jerry Coffin