主题:今天随便说两句,关于日本 -- 绝对不是白领
EXP30-C. Do not depend on the order of evaluation for side effects
转至元数据结尾
由 Robert C. Seacord创建, 最终由 David Svoboda修改于 十二月 02, 2020
转至元数据起始
Evaluation of an expression may produce side effects. At specific points during execution, known as sequence points, all side effects of previous evaluations are complete, and no side effects of subsequent evaluations have yet taken place. Do not depend on the order of evaluation for side effects unless there is an intervening sequence point.
The C Standard, 6.5, paragraph 2 [ISO/IEC 9899:2011], states
If a side effect on a scalar object is unsequenced relative to either a different side effect on the same scalar object or a value computation using the value of the same scalar object, the behavior is undefined. If there are multiple allowable orderings of the subexpressions of an expression, the behavior is undefined if such an unsequenced side effect occurs in any of the orderings.
This requirement must be met for each allowable ordering of the subexpressions of a full expression; otherwise, the behavior is undefined. (See undefined behavior 35.)
https://wiki.sei.cmu.edu/confluence/display/c/EXP30-C.+Do+not+depend+on+the+order+of+evaluation+for+side+effects
- 相关回复 上下关系8
压缩 10 层
🙂惭愧,“i+++(++i)”竟然是UB吗? 4 钛坪樽逾 字630 2021-02-17 19:15:32
🙂也是C语言灵活性的体现 3 杨微粒 字321 2021-02-18 07:24:07
🙂看了下,好像有两个? 1 杨微粒 字356 2021-02-18 02:06:58
🙂使用副作用时不要依赖求值顺序
🙂搜了下 1 杨微粒 字553 2021-02-18 02:11:10
🙂唉,这种题目既不是理也不是工,是八股 1 赵美成 字57 2020-12-15 03:35:54
🙂还有文字编码也是非常适合在中学讲授工程学的例子 杨微粒 字295 2020-12-15 03:33:09
🙂相关性不是因果性 杨微粒 字464 2020-12-14 13:39:00