You're running your program, and then it suddenly exits with the message This application has requested the Runtime to terminate it in an unusual way. What happened?
That message is printed
by the C runtime function
abort
,
the same function that also causes your program to
terminate with exit code 3.
Your program might call
abort
explicitly,
or it might end up being called implicitly
by the runtime library itself.
-
The
assert
macro callsabort
when an assertion fails. -
By default,
the
terminate
function callsabort
.
The C++ standard spells out the conditions
under which terminate
is called,
and it's quite a long list, so I won't bother
repeating them here.
Consult your favorite copy of the C++ standard
for details.
(The most common reason is throwing an unhandled exception.)