12.3.3.24 || expressions

来源:互联网 发布:同城送货软件 编辑:程序博客网 时间:2024/04/27 22:56
12.3.3.24 || expressions
For an expression expr of the form expr-first || expr-second:
?The definite assignment state of v before expr-first is the same as the
definite assignment state of v
before expr.
?The definite assignment state of v before expr-second is definitely
assigned if the state of v after
expr-first is either definitely assigned or .definitely assigned after
false expression.. Otherwise, it is
not definitely assigned.
?The definite assignment statement of v after expr is determined by:
o If the state of v after expr-first is definitely assigned, then the state
of v after expr is
definitely assigned.
o Otherwise, if the state of v after expr-second is definitely assigned,
and the state of v after
expr-first is .definitely assigned after true expression., then the state
of v after expr is
definitely assigned.
Chapter 12 Variables
111
o Otherwise, if the state of v after expr-second is definitely assigned or
.definitely assigned
after false expression., then the state of v after expr is .definitely
assigned after false
expression..
o Otherwise, if the state of v after expr-first is .definitely assigned
after true expression., and
the state of v after expr-second is .definitely assigned after true
expression., then the state
of v after expr is .definitely assigned after true expression..
o Otherwise, the state of v after expr is not definitely assigned.
[Example: In the example
class A
{
static void G(int x, int y) {
int i;
if (x >= 0 || (i = y) >= 0) {
// i not definitely assigned
}
else {
// i definitely assigned
}
// i not definitely assigned
}
}
the variable i is considered definitely assigned in one of the embedded
statements of an if statement but not
in the other. In the if statement in method G, the variable i is definitely
assigned in the second embedded
statement because execution of the expression (i = y) always precedes
execution of this embedded
statement. In contrast, the variable i is not definitely assigned in the
first embedded statement, since
x >= 0 might have tested true, resulting in the variable i抯 being
unassigned. end example]
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 微信支付失败但是钱扣了怎么办 支付宝向别人收款交易关闭了怎么办 从淘宝充的晋江币充值异常怎么办 接手转让店铺会员要求退卡怎么办 转转买手机卖家拒绝退款怎么办 淘宝买的东西电话号码留错了怎么办 平板电脑没电关机没保存文件怎么办 恢复出厂设置需要谷歌账号怎么办 华为手机云端里照片删除了怎么办 客户退货卖家一直没收到货怎么办 在淘宝买到假货投诉不管用怎么办 差评不接电话不回旺旺不要钱怎么办 饿了么同行恶意差评怎么办 苹果手机更新后淘宝用不了怎么办 淘宝网快递丢件了买家怎么办 评价后忘了截图五星好评怎么办 在淘宝被骗了好评返现怎么办 苹果4s微信版本过低怎么办 微信版本太低无法登录怎么办 苹果4微信版本低登录不了怎么办 安卓手机微信版本低登录不了怎么办 苹果微信版本低登录不了怎么办 安装包与当前版本不兼容怎么办 游戏与苹果手机系统不兼容怎么办 闲鱼买家申请退款不退货怎么办 在淘宝买的战地1登录不了怎么办 支付宝转账到注销的账号怎么办 支付宝用户支付密码被锁定怎么办 淘宝提现需要的手机宝令怎么办 手机换号码了支付宝账号怎么办 卖家收到货迟迟不给退款怎么办 闲鱼东西已发出买家申请退款怎么办 如果东西在路上买家要退款怎么办 卖家收到退的货后不退款怎么办 扣48分淘宝被限制登录怎么办 淘宝网申请退款卖家不理怎么办 高考生如果把登录密码忘记了怎么办 普高考生登录密码忘记了怎么办 淘宝买的流量卡然后网卡怎么办? 忘记了qq号绑定了手机怎么办 微信绑定qq号忘记了怎么办