views:

138

answers:

1

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.

+3  A: 

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