Sequence point after a return statement?

后端 未结 2 1393
无人及你
无人及你 2021-01-14 12:58

In my answer to a question here I explained what happened when postfix ++ was used on a global variable on the same line as a return statement.

The info

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 13:32

    I don't think you're going to find what you're looking for. no text regarding sequence points can be found that's true, it's only implied by section 6.8 p4.

    The C++ standard (ISO/IEC 14882:2003) in section 1.9 (footnote 11) states the fact that a sequence point after the return is not explicitily written anywhere in the C standards:

    11) The sequence point at the function return is not explicitly specified in ISO C, and can be considered redundant with sequence points at full-expressions, but the extra clarity is important in C + +. In C + +, there are more ways in which a called function can terminate its execution, such as the throw of an exception.

提交回复
热议问题