Levels of exception safety in C++

Discussion in 'C++' started by Pallav singh, Mar 6, 2011.

  1. Pallav singh

    Pallav singh Guest

    Hi All ,

    I am new to C++. I was looking to several levels of exception safety:

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Basic exception safety: Partial execution of failed operations can
    cause
    side effects, but invariants on the state are preserved. Any stored
    data will
    contain valid values even if data has different values now from before
    the exception.

    http://en.wikipedia.org/wiki/Exception_handling
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    stable state. An object's state is stable if none of its member or
    friend
    functions, when called with arguments that
    satisfy their
    preconditions, result in undefined behavior.
    [Note: in particular, this applies to the object's destructor.]
    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1997/N1077.asc
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    I am not able to understand them. How can they occur in Code.

    Thanks in Advance
    Pallav Singh
    Pallav singh, Mar 6, 2011
    #1
    1. Advertising

  2. Pallav singh

    WQ Guest

    WQ, Mar 7, 2011
    #2
    1. Advertising

  3. Pallav singh

    James Kanze Guest

    On Mar 7, 5:38 am, "WQ" <> wrote:
    > "Pallav singh" <> > Hi All ,


    > > I am new to C++. I was looking to several levels of exception safety:


    > I did read something about exception safe in C++,


    > Here is a good reading/discussing on the three levels safety.


    > http://stackoverflow.com/questions/1853243/c-do-you-really-write-exce...


    Bof. Like in the newsgroups, you have to be selective. The way
    the original question was phrased, it sounded almost like a
    troll. One of the responses was very good, but the rest varied
    from ordinary to downright bad. (Your reaction seems to be to
    the one that was good, because it was the only one which
    mentionned the different levels of exception safety.)

    --
    James Kanze
    James Kanze, Mar 7, 2011
    #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. John Harrison

    Exception safety in the STL

    John Harrison, Jul 6, 2003, in forum: C++
    Replies:
    5
    Views:
    4,059
    John Harrison
    Jul 8, 2003
  2. Klaus Ahrens

    array exception safety

    Klaus Ahrens, Dec 8, 2003, in forum: C++
    Replies:
    1
    Views:
    332
    tom_usenet
    Dec 8, 2003
  3. Scott Brady Drummonds
    Replies:
    3
    Views:
    886
    Dietmar Kuehl
    Jan 18, 2005
  4. Luke Meyers

    STL exception safety, operator==

    Luke Meyers, Jan 5, 2006, in forum: C++
    Replies:
    0
    Views:
    354
    Luke Meyers
    Jan 5, 2006
  5. Roger Pack
    Replies:
    1
    Views:
    108
    Ken Bloom
    Feb 8, 2009
Loading...

Share This Page