※ 引述《Tiberius.bbs@ptt.cc (渴望平凡的幸福)》之銘言:
> ISO/IEC 14882:2003
> 5. Expressions
> 4 Except where noted, the order of evaluation of operands of individual
> operators and subexpressions of individual expressions, and the order
> in which side effects take place, is unspecified. (53) Between the
^^^^^^^^^^^^
> previous and next sequence point a scalar object shall have its
^^^^^^^^^^^^^^
> stored value modified at most once by the evaluation of an expression.
> Furthermore, the prior value shall be accessed only to determine
> the value to be stored. The requirements of this paragraph shall be
> met for each allowable ordering of the subexpressions of a full expression;
> otherwise the behavior is undefined. [Example:
其實一切都在標準規格書講得很清楚了 (這段有部分根本是從 ISO C 抄來的),
但是有兩個被眾人淡忘其定義的基本名詞偏偏剛好是 keyword,
可能有些人因此就看不懂它在說什麼東西。
這時不妨查查 wiki:
http://en.wikipedia.org/wiki/Sequence_point
http://en.wikipedia.org/wiki/Side_effect_%28computer_science%29
這兩個名詞有它的重要性存在,
尤其是 sequence point,
因為它是 side effect 一定要作用完畢的分水嶺,
會看 sequence point 區隔 side effect 的作用區間非常重要,
這不單是為了應付考試,
trace 或 maintain 他人的程式碼時這會幫上很大的忙,
寫程式的生涯裡並不是永遠只要看自己的程式碼,
所以備妥基本觀念以防不時之需其實不會吃虧。
--
Name: Tseng, Ling-hua E-mail Address: uranus@it.muds.net
School: National Tsing Hua University Department: Computer Science
Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design
Researching: Software pipelining for VLIW architectures
Homepage: https://it.muds.net/~uranus
--
╔═══╗ ┼────────────────────────╮
║狂狷 ║ │* Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮
║ 年少║ ┼╮ < IP:140.119.164.252 > ╰─╮
╚╦═╦╝ ╰ * From:61-230-216-132.dynamic.hinet.net
─╨─╨─ KGBBS ─ ◎ 遨翔"BBS"的狂狷不馴;屬於年少的輕狂色彩 ◎