By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,612 Members | 1,632 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,612 IT Pros & Developers. It's quick & easy.

Strange Exception Specification Behaviour

P: n/a
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?

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2005-06-07, Paul Drummond <pa***********@dsl.pipex.com> wrote:
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,
--
Donovan Rebbechi
http://pegasus.rutgers.edu/~elflord/
Jul 23 '05 #2

P: n/a
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?

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.