Recent g++ versions provide limited support for exceptions. You must
provide the -fhandle-exceptions
flag to enable exception
handling. As of version 2.7.2, exceptions may not work properly
(and you may get odd error messages when compiling) if you turn
on optimization (the -O
flag).
You must give the -frtti
switch to enable catching
of derived exception objects with handlers for the base exception class;
if -frtti
is not given, only exact type matching works.
For exception handling to work with 2.7.0 your CPU must be a SPARC, RS6000/PowerPC, 386/486/Pentium, or ARM. Release 2.7.1 added support for the Alpha, and "m68k is rumored to work on some platforms" and "VAX may also work" (according to Mike Stump). It still doesn't work on HP-PA or MIPS platforms.