Strange Exception Specification Behaviour

P

Paul Drummond

Hi all,

I am developing software for Linux Redhat9 and I have noticed some very
strange behaviour when throwing exceptions within a shared library.
All our exceptions are derived from std::exception. We have a base
class which all processes derive from which is always instantiated in
main surrounded by a try/catch(std::exception) which catches all
exceptions that have not be handled at a higher level. The catch block
cleans up and attempts to restart the process. Standard stuff.

During testing however, we noticed that quite a few tasks were crashing
without any error message other than "Aborted" on stdout (or stderr
maybe). During debugging it was found that the abort would occur
directly after a throw from within the shared library.

The strange thing is that the problem **DISAPPEARS** by including an
exception specification for every single method in the hierarchy of
calls from main to where the throw occurs! Does this mean that
exception specifcations are mandatory? No, it can't because by
definition, no exception specification means that a method can throw
anything!

I have tried isolating the problem using a dummy shared lib and a test
harness but it works fine without any exception specification which
suggests they are not mandatory, and that there is something else going
on!

Can anyone offer any insight into this strange behaviour?
 
D

Donovan Rebbechi

The strange thing is that the problem **DISAPPEARS** by including an
exception specification for every single method in the hierarchy of
calls from main to where the throw occurs! Does this mean that
exception specifcations are mandatory? No, it can't because by
definition, no exception specification means that a method can throw
anything!

I have tried isolating the problem using a dummy shared lib and a test
harness but it works fine without any exception specification which
suggests they are not mandatory, and that there is something else going
on!

Can anyone offer any insight into this strange behaviour?

This problem can happen when something in the chain isn't built with
support for exceptions. People have had this problem writing modules
for python, for example. Use google, it's been discussed elsewhere but
not topical here.

Cheers,
 
P

Paul Drummond

I spent about 2 weeks on and off searching google for a solution to
this. Certain topics were relevant but all suggested solutions have
failed to fix the problem.

How is my problem not topical here? It's a c++ problem is it not? If
not here then where should I post this sort of problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top