exception specification

Discussion in 'C++' started by Tony Johansson, May 30, 2005.

  1. Hello!

    In this overloaded index operator I have just add this throw() in the header
    just to check what happen when an exception is thrown.
    This throw() in the header should means that this method should not throw
    anything.
    But the strange thing is that I don't get any error when this user defined
    exception MyOutOfRange is throw.
    Can anybody explain that to me?

    int& operator[](int i) throw() ; //Here is the declaration

    int& Intvektor::eek:perator[](int i) throw()
    {
    if (i >= size || i < 0)
    throw MyOutOfRange("Intvektor:: Positionering som ligger utanför
    giltigt område\n");
    return array;
    }

    //Tony
     
    Tony Johansson, May 30, 2005
    #1
    1. Advertising

  2. Tony Johansson

    Rapscallion Guest

    Tony Johansson wrote:
    > In this overloaded index operator I have just add this throw() in the header
    > just to check what happen when an exception is thrown.
    > This throw() in the header should means that this method should not throw
    > anything.
    > But the strange thing is that I don't get any error when this user defined
    > exception MyOutOfRange is throw.
    > Can anybody explain that to me?


    You mean, you get no runtime error? Then you are probably using a
    Microsoft compiler. MS decided to not fully support the C++ Standard
    WRT exception specifications.
     
    Rapscallion, May 30, 2005
    #2
    1. Advertising

  3. Tony Johansson wrote:
    > Hello!
    >
    > In this overloaded index operator I have just add this throw() in the header
    > just to check what happen when an exception is thrown.
    > This throw() in the header should means that this method should not throw
    > anything.
    > But the strange thing is that I don't get any error when this user defined
    > exception MyOutOfRange is throw.
    > Can anybody explain that to me?



    Which compiler were you using ?
     
    Gianni Mariani, May 30, 2005
    #3
  4. "Gianni Mariani" <> skrev i meddelandet
    news:...
    > Tony Johansson wrote:
    >> Hello!
    >>
    >> In this overloaded index operator I have just add this throw() in the
    >> header just to check what happen when an exception is thrown.
    >> This throw() in the header should means that this method should not throw
    >> anything.
    >> But the strange thing is that I don't get any error when this user
    >> defined exception MyOutOfRange is throw.
    >> Can anybody explain that to me?

    >
    >
    > Which compiler were you using ?


    I'm using MS .net
     
    Tony Johansson, May 30, 2005
    #4
  5. "Rapscallion" <> skrev i meddelandet
    news:...
    > Tony Johansson wrote:
    >> In this overloaded index operator I have just add this throw() in the
    >> header
    >> just to check what happen when an exception is thrown.
    >> This throw() in the header should means that this method should not throw
    >> anything.
    >> But the strange thing is that I don't get any error when this user
    >> defined
    >> exception MyOutOfRange is throw.
    >> Can anybody explain that to me?

    >
    > You mean, you get no runtime error? Then you are probably using a
    > Microsoft compiler. MS decided to not fully support the C++ Standard
    > WRT exception specifications.
    >

    What does WRT mean?

    //Tony
     
    Tony Johansson, May 30, 2005
    #5
  6. Tony Johansson

    Artie Gold Guest

    Tony Johansson wrote:
    > "Rapscallion" <> skrev i meddelandet
    > news:...
    >
    >>Tony Johansson wrote:
    >>
    >>>In this overloaded index operator I have just add this throw() in the
    >>>header
    >>>just to check what happen when an exception is thrown.
    >>>This throw() in the header should means that this method should not throw
    >>>anything.
    >>>But the strange thing is that I don't get any error when this user
    >>>defined
    >>>exception MyOutOfRange is throw.
    >>>Can anybody explain that to me?

    >>
    >>You mean, you get no runtime error? Then you are probably using a
    >>Microsoft compiler. MS decided to not fully support the C++ Standard
    >>WRT exception specifications.
    >>

    >
    > What does WRT mean?


    "With Respect To"

    HTH,
    --ag

    --
    Artie Gold -- Austin, Texas
    http://it-matters.blogspot.com (new post 12/5)
    http://www.cafepress.com/goldsays
     
    Artie Gold, May 30, 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. Gaurav
    Replies:
    0
    Views:
    16,179
    Gaurav
    Nov 7, 2003
  2. Paul Drummond
    Replies:
    2
    Views:
    318
    Paul Drummond
    Jun 8, 2005
  3. Paul Brettschneider

    Exception specification checked at *runtime*?

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

Share This Page