views:

42

answers:

1

In MSVC++ I have a vector.

Whenever you go out of bounds of the vector (in debug mode, launched as "Start Debugging"), when you step out of bounds of the vector the program halts with a dialog box:

Microsoft Visual C++ Debug Library
====

Debug Assertion Failed!

Expression: Vector subscript out of range

Abort | Retry | Ignore

So what I want though is the MSVC++ debugger within visual studio to STOP AT THE LINE WHERE THE OUT OF BOUNDS OCCURRED, not give me this dialog box.

How can I cause the program to "break" properly and be able to step through code /inspect variables when an out of bounds occurs on an STL vector?

+2  A: 

Usually with Visual Studio you have the 'Retry' option. That will bring the debugger to the line or area to where your application died. Then you can check the stack trace and see why you went out of bounds.

Robb
Well, `Retry` doesn't really help as it takes me into `vector`, but not the code that lead to the trip into `vector`
bobobobo
I was referring to how you can view the "Call Stack" window to see the methods that lead into the vector code
Robb
Retry will usually take you to where the error was detected, not where the error was caused. As Robb says follow the stack to see why you got here.
Stephen Nutt