2

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.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
SteveGSD
  • 1,750
  • 1
  • 17
  • 28

1 Answers1

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