Mail Archives: djgpp/1996/09/05/20:35:30
| My problem was with optimisation switches.
| The following definitely works:
|
| gcc -fhandle-exceptions -o test.exe test.cc -lstdcx
|
| and so does:
|
| gcc -O2 -fhandle-exceptions -o test.exe test.cc -lstdcx
|
| However, the -O3 optimisation switch (which I was using
| by default) breaks the catch mechanism so that
| terminate() is the result of every throw.
From the Gnu C++ documentation on exception handling:
Don't expect exception handling to work right if you optimize, in fact the
compiler will probably core dump.
You're lucky it works with -O2 at all (and might not if you have a more
complicated program or try and compile it on a more complicated architecture).
--
+------------------------+----------------------+
| Mike Marcelais | Excel Developer and |
| michmarc AT microsoft DOT com | Magic Rules Guru |
+------------------------+----------------------+
| Opinions expressed in this post are mine, and |
| do not necessarily reflect those of Microsoft |
+--= Moonstone Dragon =---------------= UDIC =--+
- Raw text -