Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

In Visual Studio 2005, is there any such thing as array bounds checking?

I keep stepping on my variables in Visual Studio 2005 (C++) because I'm exceeding my array bounds. Visual Studio doesn't have a problem with this; it just overwrites whatever was in the previous variable and continues. It can lead to strange results in my program, and it takes forever to track down such problems.

Is there a switch a I can flip somewhere in the Visual Studio 2005 IDE to warn me if I'm exceeding my array bounds?

1 Answer

Relevance
  • Pfo
    Lv 7
    1 decade ago
    Favorite Answer

    Within the .Net framework, array bounds checking is automatic. Array access is automatically checked to ensure a valid element is accessed. The only exception to this is when you use unsafe code: array bounds checks are ignored. Also, if you call into native (i.e. not managed) code, then obviously the array bounds checking of that native code is going on (and usually their is none).

    If you can exceed the bounds of an array by accessing an element beyond it, I would suspect your installation of the .Net framework is corrupt and I would reinstall it.

Still have questions? Get your answers by asking now.