Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.??

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...