摘要: checked 关键字用于对整型算术运算和转换显式启用溢出检查。默认情况下,如果表达式仅包含常数值,且产生的值在目标类型范围之外,则它会导致编译器错误。 如果表达式包含一个或多个非常数值,则编译器不检测溢出。 在下面的示例中,计算赋给 i2 的表达式不会导致编译器错误。// The following example causes compiler error CS0220 because 2147483647// is the maximum value for integers. //int i1 = 2147483647 + 10;// The following example, wh 阅读全文
posted @ 2011-11-07 13:23 黎明露珠 阅读(8453) 评论(0) 推荐(1) 编辑