<<< /en/programming

Antti-Juhani Kaijanaho: C++ exceptions considered harmful

Is there a mechanism to figure out what exception it is that fails to be caught by any exception handler on the stack? Of course, it can be caught by using catch (...), but that just tells me as much as G++'s default handler: that some exception was thrown.

I've been implementing the Hao compiler in C++, as C was too low-level but I wanted something widespread. A public darcs repository is available for curious bystanders to stare at; I doubt anybody gets much out of it (the haoc/ subdirectory contains the compiler in development; the other directories are more or less stale). I push to that repository occasionally; it's not necessarily up to date.

2004-05-13T23:22+0300 - /en/programming


Trackback url: http://antti-juhani.kaijanaho.info/blog/en/programming/cc-exceptions.trackback (trackback on rikki / trackback is broken)

Re: C++ exceptions considered harmful

If you only use exceptions that are objects of classes derived from std::exception, then you can catch the object and find out its exact type. All of the "standard exceptions" are so derived (std::bad_cast, etc).

- Joe Buck, la, 15 touko  2004 03:24

Your Comment