Integer Arithmetic...

FlyBoy

Centurion
Joined
Sep 6, 2004
Messages
106
there are the "checked" and "unchecked" keywords to identify int overflows...
i get the idea of the "checked"..but why do i need the "unchecked"???
isnt the default mode is in "unchecked" mode,i mean when i dont use anything.??
 
integer arithmetic inside a checked block will throw an exception if the statement would cause either an overflow or an underflow.
unchecked blocks will just wrap round and not generate any errors.
The reason both keywords exist is the default behaviour can be set on a project by project basis - and as such you may need to override that behaviour in certain places.
 
PlausiblyDamp said:
integer arithmetic inside a checked block will throw an exception if the statement would cause either an overflow or an underflow.
unchecked blocks will just wrap round and not generate any errors.
The reason both keywords exist is the default behaviour can be set on a project by project basis - and as such you may need to override that behaviour in certain places.

i see...10x for the reply!
 
Back
Top