Explicit calls to unexpected()?

Discussion in 'C++' started by Ken, May 25, 2004.

  1. Ken

    Ken Guest

    Any thoughts on making explicit calls to unexpected()? My sense is
    that this function is really intended to be invoked automatically as
    part of exception handling. Are there times when explicit calls would
    be useful? Or would doing so introduce bug risks or maintanance
    headaches unnecessarily?

    Thanks for any opinions!

    Ken
     
    Ken, May 25, 2004
    #1
    1. Advertising

  2. (Ken) wrote in message news:<>...
    > Any thoughts on making explicit calls to unexpected()? My sense is
    > that this function is really intended to be invoked automatically as
    > part of exception handling. Are there times when explicit calls would
    > be useful? Or would doing so introduce bug risks or maintanance
    > headaches unnecessarily?
    >
    > Thanks for any opinions!
    >
    > Ken


    I think the name says it all really. If you call unexpected()
    explicitly, then it's not really unexpected is it? ;-)

    The only possible reason for doing so I can think of would have to be
    in a assert() type of function, since unexpected() normally calls
    abort() which will abort the program(duh!).

    And I guess it would introduce maintainance problems since the first
    thing I would think of when seeing an explicit call to unexpected
    would be utter confusion.

    T.
     
    Truls Haaland, May 26, 2004
    #2
    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. Jacques Labuschagne

    Explicit ctor/dtor calls

    Jacques Labuschagne, Jul 20, 2003, in forum: C++
    Replies:
    3
    Views:
    346
    Michael Kochetkov
    Jul 20, 2003
  2. J.T. Conklin
    Replies:
    1
    Views:
    442
    David Hilsee
    Aug 11, 2004
  3. Andy
    Replies:
    5
    Views:
    508
    Shezan Baig
    Jan 30, 2005
  4. Robert Dick
    Replies:
    1
    Views:
    316
    Thomas Guettler
    Dec 17, 2004
  5. Replies:
    1
    Views:
    579
    Salt_Peter
    Dec 25, 2006
Loading...

Share This Page