打印
[嵌入式linux]

请问这句代码什么意思?(复合语句)

[复制链接]
1629|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fineamy|  楼主 | 2007-3-30 11:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
fineamy|  楼主 | 2007-4-2 09:24 | 只看该作者

语句没问题,


The middle operand in a conditional expression may be omitted. Then if the first operand
is nonzero, its value is the value of the conditional expression.
Therefore, the expression
x ? : y
has the value of x if that is nonzero; otherwise, the value of y.
This example is perfectly equivalent to
x ? x : y
In this simple case, the ability to omit the middle operand is not especially useful. When it
becomes useful is when the first operand does, or may (if it is a macro argument), contain a side effect. Then repeating the operand in the middle would perform the side effect twice.
Omitting the middle operand uses the value already computed without the undesirable
effects of recomputing it.

This is GCC Extensions to the C Language Family

使用特权

评论回复
板凳
sinanjj| | 2011-8-14 14:18 | 只看该作者
看好lz.

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

14

主题

59

帖子

1

粉丝