Recommended practise for exceptions specifications?

Discussion in 'C++' started by Carsten Fuchs, May 18, 2005.

  1. Hello all,

    what please is the recommended (most future-safe, standard-compliant
    etc.) practise for exception specifications?

    I did some googling, and the trend seemed to be "don't use exception
    specifications at all". Well, I was wondering if this is still valid, or
    if there are newer trends in the standard that (partially) solve the
    related problems.

    Thank you very much.

    Best regards,
    Carsten



    --
    Ca3D - Engine http://www.Ca3D-Engine.de
    Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
    Carsten Fuchs, May 18, 2005
    #1
    1. Advertising

  2. Carsten Fuchs

    Rapscallion Guest

    Carsten Fuchs wrote:
    > what please is the recommended (most future-safe, standard-compliant
    > etc.) practise for exception specifications?
    >
    > I did some googling, and the trend seemed to be "don't use exception
    > specifications at all". Well, I was wondering if this is still valid,

    or
    > if there are newer trends in the standard that (partially) solve the
    > related problems.


    Also read the respective chapters in Stroustrup's "The C++ Programming
    Language".
    Rapscallion, May 18, 2005
    #2
    1. Advertising

  3. Carsten Fuchs

    ben Guest

    exception specification is not an easy task for compiler writers so most
    compilers are shipped without that feature compliant to the standard. Read
    your compiler documentation.

    ben

    "Carsten Fuchs" <> wrote in message
    news:428b0d3f$0$14746$-online.net...
    > Hello all,
    >
    > what please is the recommended (most future-safe, standard-compliant
    > etc.) practise for exception specifications?
    >
    > I did some googling, and the trend seemed to be "don't use exception
    > specifications at all". Well, I was wondering if this is still valid, or
    > if there are newer trends in the standard that (partially) solve the
    > related problems.
    >
    > Thank you very much.
    >
    > Best regards,
    > Carsten
    >
    >
    >
    > --
    > Ca3D - Engine http://www.Ca3D-Engine.de
    > Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
    ben, May 18, 2005
    #3
  4. ben wrote:
    > Read your compiler documentation.


    I have, that is the very problem: I want portable, compiler-independent
    code. That is also the reason why I posted here rather than in a
    compiler-specific group.

    Best,
    Carsten



    --
    Ca3D - Engine http://www.Ca3D-Engine.de
    Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
    Carsten Fuchs, May 18, 2005
    #4
  5. Carsten Fuchs

    Ron Natalie Guest

    ben wrote:
    > exception specification is not an easy task for compiler writers so most
    > compilers are shipped without that feature compliant to the standard. Read
    > your compiler documentation.
    >

    Even when they are compliant with the standard, the feature is by
    and large, useless.
    Ron Natalie, May 18, 2005
    #5
  6. Carsten Fuchs

    Jerry Coffin Guest

    Carsten Fuchs wrote:
    > Hello all,
    >
    > what please is the recommended (most future-safe, standard-compliant
    > etc.) practise for exception specifications?
    >
    > I did some googling, and the trend seemed to be "don't use exception
    > specifications at all".


    That's still pretty much the case.

    > Well, I was wondering if this is still valid, or
    > if there are newer trends in the standard that (partially) solve the
    > related problems.


    There are some compilers that can optimize some code if you use an
    empty exception specification, and based on that a few people recommend
    that particular use in limited circumstances. IMO, this is rarely
    really justified. From what I've seen so far, it's usually quite a bit
    of work for a fairly minor optimization, and a fair amount of potential
    for problems as well.

    IOW, I'm still fairly firmly in the "don't use them" camp, but it seems
    only fair to say that there is another camp out there, and even if you
    don't hear from any of them directly, you should be aware that there's
    _some_ difference of opinion on the subject.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
    Jerry Coffin, May 19, 2005
    #6
    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. Philipp Holzschneider
    Replies:
    6
    Views:
    466
    Ron Natalie
    Oct 2, 2003
  2. Scott Brady Drummonds

    Exception Specifications Using Undefined Class

    Scott Brady Drummonds, Jul 29, 2004, in forum: C++
    Replies:
    1
    Views:
    351
    Denis Remezov
    Jul 29, 2004
  3. Francis Chee
    Replies:
    6
    Views:
    424
    Jazeker
    Feb 22, 2005
  4. mosscliffe

    Ideal Computer Specifications

    mosscliffe, May 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    335
    mosscliffe
    May 28, 2006
  5. Slaunger
    Replies:
    2
    Views:
    239
    Slaunger
    Nov 17, 2008
Loading...

Share This Page