Strange Exception Specification Behaviour

Discussion in 'C++' started by Paul Drummond, Jun 7, 2005.

  1. 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?
     
    Paul Drummond, Jun 7, 2005
    #1
    1. Advertising

  2. On 2005-06-07, Paul Drummond <> 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/
     
    Donovan Rebbechi, Jun 7, 2005
    #2
    1. Advertising

  3. 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?
     
    Paul Drummond, Jun 8, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gaurav
    Replies:
    0
    Views:
    16,158
    Gaurav
    Nov 7, 2003
  2. Tony Johansson

    exception specification

    Tony Johansson, May 30, 2005, in forum: C++
    Replies:
    5
    Views:
    365
    Artie Gold
    May 30, 2005
  3. Paul Brettschneider

    Exception specification checked at *runtime*?

    Paul Brettschneider, Nov 1, 2007, in forum: C++
    Replies:
    8
    Views:
    516
    Paul Brettschneider
    Nov 3, 2007
  4. Replies:
    2
    Views:
    344
  5. George2
    Replies:
    14
    Views:
    584
    Grizlyk
    Jan 22, 2008
Loading...

Share This Page