听说这两天你们要考理论了,正好我也在看标准
浏览量:4704 回帖数:23
13楼
IOS C++ 11 的标准里面,第6.4.2 the switch statement
第五条写到:When the switch statement is executed, its condition is evaluated and compared with each case constant. If one of the case constants is equal to the value of the condition, control is passed to the statement following the matched case label. If no case constant matches the condition, and if there is a default label, control passes to the statement labeled by the default label.
所以说,如果default 在case前面,它应该会跳过这个,依序判断每一个case,只有都不符合的时候才会执行default。我去测试一下
IOS C++ 11 的标准里面,第6.4.2 the switch statement
第五条写到:When the switch statement is executed, its condition is evaluated and compared with each case constant. If one of the case constants is equal to the value of the condition, control is passed to the statement following the matched case label. If no case constant matches the condition, and if there is a default label, control passes to the statement labeled by the default label.
所以说,如果default 在case前面,它应该会跳过这个,依序判断每一个case,只有都不符合的时候才会执行default。我去测试一下
签名档
无尽的激情之后,是否也终于会归于平静呢, 玫瑰在烈焰中燃烧,焦黑糊烂而芬芳, 只希望他们之间,也是【无尽的华尔兹】 ♂想找个人,可以抱着她一起看相片… …♀
发表于 2009/9/21 21:03:30

