开发者

Throwing an exception if, for example, int a = Integer.MIN_VALUE-1; [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

开发者_如何学Python

Closed 8 years ago.

Improve this question

Do you know of any languages which would throw an Exception on Overflow or Underflow? Thanks


.Net framework has a dedicated exception for Overflow

OverflowException Class


In C# you can let underflow and overflow throw exceptions using the checked keyword:

int a = checked(Integer.MIN_VALUE - 1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜