"throw" crashes program, but compiles fine

My program compiles fine, but crashes everytime throw (not inside of a try...catch block) is called.

Here are the command like arguments used for all files in the project:

mingw32-g++.exe -fexceptions -DWIN32 -D_WINDOWS -D_MBCS -DNO_SOCKLEN_T -DDONTUSEMEMMANAGER -Wall -g -W -fexceptions -DDEBUG

(I know that Wall makes W unnecessary and that I have -fexceptions in there twice.)

edit: I know that the there's actually nothing wrong with that behaviour. the thing is, it used to work aka the program wouldn't crash. but some days ago I made a change to some of the files , compiled again and all of a sudden it crashed

Answers


Well, this is the expected behavior. The standard says [except.handle]:

If no matching handler is found, the function std::terminate() is called; [...]


That is called an unhandled exception. The expected behavior is that the program should exit.


Need Your Help

Problem in implementing IAlertUpdateHandler interface

sharepoint email alerts sharepoint-alerts

I've implemented IAlertUpdateHandler interface in a class and used it for handling creation and updating of alerts. The code is fired but it goes into endless loop by calling itself again and again...

onclick window.location.href with variable

javascript php window.location

I have a select with some options inside and I want the user to be sent to another page with a variable in the URI so that I can extract it.