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?
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?