Chinaunix首页 | 论坛 | 博客
  • 博客访问: 173642
  • 博文数量: 108
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1065
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-29 08:56
文章分类

全部博文(108)

文章存档

2011年(11)

2010年(46)

2009年(29)

2008年(22)

我的朋友

分类: C/C++

2008-12-23 05:00:47

A small set of operators connect subexpressions with side effect operators
and guarantee that the entire expression evaluates the same on all machines. We
call these operators sequence guarantee operators. C provides only four.

Sequence guarantee operators

Operator     Meaning
&&          logical AND
||          logical OR
,           comma
?:          conditional



///////////////////////////////////////////////////////////////////////////////////

Accessing a volatile object, modifying an object, modifying a file, or calling a function that does any of those operations are all side effects, which are changes in the state of the execution environment. Evaluation of an expression may produce side effects. At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place. (A summary of the sequence points is given in annex C.)

Sequence points
 The following are the sequence points described in 5.1.2.3:

— The call to a function, after the arguments have been evaluated (6.5.2.2).
— The end of the first operand of the following operators: logical AND && (6.5.13);
logical OR || (6.5.14); conditional ? (6.5.15); comma , (6.5.17).
— The end of a full declarator: declarators (6.7.5);
— The end of a full expression: an initializer (6.7.8); the expression in an expression
statement (6.8.3); the controlling expression of a selection statement (if or switch)
(6.8.4); the controlling expression of a while or do statement (6.8.5); each of the
expressions of a for statement (6.8.5.3); the expression in a return statement
(6.8.6.4).
— Immediately before a library function returns (7.1.4).
— After the actions associated with each formatted input/output function conversion
specifier (7.19.6, 7.24.2).
— Immediately before and immediately after each call to a comparison function, and
also between any call to a comparison function and any movement of the objects
passed as arguments to that call (7.20.5).
§C Sequencepoints 437
阅读(601) | 评论(0) | 转发(0) |
0

上一篇:C++中const总结

下一篇:2440 qtopia zz

给主人留下些什么吧!~~