Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

A failure to handle exceptions

Skip to first unread message

James Moe

Mar 27, 2016, 8:30:15 AM3/27/16

gcc v3.3.5

When the exception is thrown "throw error_handler(pmmsend_rc)" the
program aborts (SIGABRT). The constructor completes; the abort occurs
after initialization, presumably in the catch() statement.
I can see no reason for this unreasonable behavior.
Am I missing anything? Or should I blame the compiler?

class error_handler {
const char * txt;
pmmsend_return_code_t rc;

error_handler (pmmsend_return_code_t err_rc = RC_NO_ACTION) { rc =
err_rc; }
pmmsend_return_code_t return_code () const { return rc; };

const char * return_text () {
switch (rc)
default: txt = "Unhandled Error";
case RC_NO_ERROR: txt = "No Error";
case RC_NO_ACTION: txt = "Nothing happened";
case RC_HELP: txt = "Help displayed";
// more to come...
return txt;

int main (int argc, char *argv[])
pmmsend_return_code_t pmmsend_rc = RC_NO_ACTION;
prog_args_t prog_args;

try {
if (RC_NO_ERROR != pmmsend_rc)
throw error_handler(pmmsend_rc);

// build message
// send message
catch (const error_handler & ex) {
cerr << "Error: " << ex.return_code() << endl;
catch (...) {
cerr << "Splat! The unhandled error." << endl;



James Moe
jmm-list at sohnen-moe dot com

[ See for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Martin Bonner

Mar 29, 2016, 8:10:17 AM3/29/16
That is not your complete program. (You have omitted the definition of
pmmsend_return_code_t at a minimum). Have you elided anything else?
If so I suspect that is where your problem lies. The other potential
problem might be that your constructor never initializes "txt" (but you
never use it either, so that *should* be alright).


Ralf Fassel

Mar 29, 2016, 2:40:09 PM3/29/16

* James Moe <>
| gcc v3.3.5
| Am I missing anything? Or should I blame the compiler?

gcc 3.3.5 was released in September 2004, and I doubt it that anyone is
still working or even interested in gcc problems dating back that far.
Better retry using a current compiler version (and provide a compilable
example when you find the same error there).


0 new messages