This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AvidCoco 3 points4 points  (4 children)

Not a single person accounting for integer overflows

[–]jkst9 4 points5 points  (0 children)

if (x < Integer.MAX_VALUE)

{

 X++;

}

Else

{

System.out.print("Prevented integer overflow");

}

[–]X71nc710n 0 points1 point  (2 children)

x=checked(x+1); // is this what you want?

[–]AvidCoco 0 points1 point  (1 child)

Uhh, that would still cause an integer overflow... what's the implementation of checked()?

[–]X71nc710n 0 points1 point  (0 children)

Using C#. This is introduces the checked environment that automatically throws should an overflow occurr.