Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 634923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:20:55+00:00 2026-05-13T20:20:55+00:00

I am accustomed to C# not performing overflow checks, as the language spec states

  • 0

I am accustomed to C# not performing overflow checks, as the language spec states (§7.5.12):

For non-constant expressions (expressions that are evaluated at run-time) that are not enclosed by any checked or unchecked operators or statements, the default overflow checking context is unchecked unless external factors (such as compiler switches and execution environment configuration) call for checked evaluation.

I took advantage of this when doing an array bounds check in low-level code:

if ((uint)index >= (uint)TotalCount)
    ...

If index is negative, I expect it to become a large positive number so that it exceeds TotalCount. However, to my surprise, a negative number produces OverflowException, and I have to wrap the expression in unchecked(). I looked through the project options in Visual Studio and I do not see an option to enable or disable overflow checking. So why might it be on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:20:55+00:00Added an answer on May 13, 2026 at 8:20 pm

    It should be in the project.

    1. Double click the Properties folder.
    2. Build tab.
    3. Click the Advanced… button.
    4. Uncheck “Check for arithmetic overflow/underflow”.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've become so accustomed to stack overflow style formatting that I find it a
I am accustomed to java.io.* and java.util.* but not to the tree: com.starbase.util Class
I have been struggling with this for quite some time having been accustomed to
I'm not particularly accustomed to generating complex SQL queries and am having difficulty in
I have a Silverlight3 application that is meant to run on both Windows and
I am not accustomed to use Var implicitly typed variable. Anyone can let me
If I type a method name that does not exist, Eclipse always offers me
Does anybody know of a managed programming language implemented on .NET that contains a
I have become accustomed to using TryParse for attempting to parse unknown types: Dim
This is a feature I have grown accustomed to in Eclipse ( Ctrl +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.