Integer Arithmetic...

FlyBoy

Well-known member
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!
 

Similar threads

J
Replies
0
Views
59
Jalil Sear [MCPD SharePoint]
J
F
Replies
0
Views
75
F.oliveirarocha
F
T
Replies
0
Views
153
Tech Aspirant
T
Back
Top