I know that this was an advanced compiler option in previous versions of Visual Studio, is there a way to disable array bounds checking in Visual Studio 2008? There's no option for it that I can see.
Asked
Active
Viewed 1,073 times
2
-
2you might be interested in Rico Mariani's post: http://blogs.msdn.com/ricom/archive/2006/07/12/663642.aspx – Mitch Wheat Jan 06 '10 at 08:41
-
Thanks, that was a pretty insightful article. – SteveGSD Jan 06 '10 at 09:01
1 Answers
4
No, that's not possible. Not having array bound checking in C/C++ is how Microsoft got into such deep trouble with malware. It is a no-no in managed code. For and For Each loops will run without bound checking if the JIT compiler can detect that the begin- and end-indices are within bounds. This is one of the reasons that the For loop "TO" value is only evaluated once.

Hans Passant
- 922,412
- 146
- 1,693
- 2,536