Thread: constructors/destructors in exception

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    34

    Angry constructors/destructors in exception

    Hey there

    Can someone explain how constructors/destructors work in exception handling?

    Thks.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    EXPERIMENTATION...(write some code and see it works).

    You can throw inside of, and try/catch within, constructors and destructors.

    However, you must be careful when throwing exceptions within destructors. This is because the destructor may have been called due to stack-unwinding from a previous exception!

    Read more about exceptions here.

    gg

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    if you want to learn about exceptions then go here and be prepared to read everything.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 07:33 AM
  2. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  3. Handle C++ exception and structured exception together
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2008, 09:21 PM
  4. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM
  5. Problem with the exception class in MINGW
    By indigo0086 in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2007, 01:12 PM