Re: [AD] -fomit-frame-pointer Again |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Julien Cugnière wrote:
> Could you elaborate on that ? I've been using
> -fomit-frame-pointer on my C++
> project, which uses exceptions, and I never noticed
> anything...
The issue is if you throw an exception from inside a
callback called from one of allegro's functions, the
program will terminate.
Take this small program for example:
#include <allegroh.h>
int d_foo_proc(int, DIALOG*, int);
int main() {
DIALOG d[] =
{
{ d_foo_proc },
{ 0 }
};
try {
do_dialog(d, -1);
} catch(...) {
allegro_message("A fatal error has occured.\n");
}
return 0;
}
int d_foo_proc(int, DIALOG*, int) {
throw "Error!"; // At runtime throw will not be
able to find the try block due to lack of a frame
pointer in do_dialog and will therefore result in a
call to std::terminate
return D_O_K;
}