Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Strange Exception Specification Behaviour

Reply
Thread Tools

Strange Exception Specification Behaviour

 
 
Paul Drummond
Guest
Posts: n/a
 
      06-07-2005
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?

 
Reply With Quote
 
 
 
 
Donovan Rebbechi
Guest
Posts: n/a
 
      06-07-2005
On 2005-06-07, Paul Drummond <(E-Mail Removed)> 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/
 
Reply With Quote
 
 
 
 
Paul Drummond
Guest
Posts: n/a
 
      06-08-2005
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bjarne's comments about exception specification George2 C++ 14 01-22-2008 05:03 AM
Is an exception specification needed if the method throws and catchesits own exception? elcapitan666@gmail.com C++ 2 11-27-2007 04:01 AM
Exception specification checked at *runtime*? Paul Brettschneider C++ 8 11-03-2007 10:14 AM
exception specification Tony Johansson C++ 5 05-30-2005 10:52 PM
connection string exception : Format of the initialization string does not conform to specification starting at index 0 Gaurav ASP .Net 0 11-07-2003 10:24 AM



Advertisments