Exception when calling delete - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24

Thread: Exception when calling delete

  1. #16
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by CornedBee
    Aside from fully agreeing with the previous posters, you can catch Windows SEH exceptions with
    catch(...)
    but you don't know what hit you.
    is there some clearance sell on SExceptions today??? just in time for christmas??? This must make my 6th comment on it today...

    install a set_se_translator(...) re-throw, after a stackwalk(...) if you like...your catch(...) becomes catch(unsigned int foo)

  2. #17
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by CornedBee
    Aside from fully agreeing with the previous posters, you can catch Windows SEH exceptions with
    catch(...)
    but you don't know what hit you.
    And you don't know what state your process or thread is in. Did the thread have a stack overflow? Are you sure you can recover? Was there a privileged instruction? Did the thread forget to release a mutex in the stack-unwinding? etc...
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  3. #18
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,471
    All of which brings us back to: fix the underlying problem.
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


  4. #19
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    Yep. Oh, and stack overflows cannot be caught that way.
    All the buzzt
    CornedBee

  5. #20
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by CornedBee
    Yep. Oh, and stack overflows cannot be caught that way.
    Incorrect.
    An exception 0xc00000fd sure can be caught by "catch( ... )" or by using structured exception handling via set_se_translator...
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  6. #21
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    Right. Hmm, I was sure that I remembered something written about stack overflows immediatly and irrecoverably terminating the application.
    All the buzzt
    CornedBee

  7. #22
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by CornedBee
    Right. Hmm, I was sure that I remembered something written about stack overflows immediatly and irrecoverably terminating the application.
    Well... if you don't catch it...
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  8. #23
    Join Date
    Aug 1999
    Posts
    586
    Originally posted by vicodin451
    Incorrect.
    An exception 0xc00000fd sure can be caught by "catch( ... )" or by using structured exception handling via set_se_translator...
    Anyone catching an "exception" that results from undefined behaviour including platform-specific failures (such as a stack overflow), really needs to hit the (C++) books again.

  9. #24
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by Sef
    Anyone catching an "exception" that results from undefined behaviour including platform-specific failures (such as a stack overflow), really needs to hit the (C++) books again.
    The "void main()" is a typically a giveaway that though this is the non-VC++ forum, the OP is using VC++. The talk of structured exceptions is of course Windows-specific.

    IIRC, Richter details an example of catching a stack overflow and recovering from it in "Programming Applications for Microsoft Windows".

    At any rate, if you will follow this thread, you will see that it was not recommended that the OP do anything along the lines of catching any sort of "exception" caused by "undefined behavior". The OP was urged to correct the problem rather than hide its effects.
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center