Thread: Structured exception

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    Structured exception

    Hello everyone,


    I am learning structured exception from,

    http://msdn2.microsoft.com/en-us/lib...09(VS.85).aspx

    I read a couple of links from MSDN, but still confused what is structured exception, what is the differences between structure exception and our normal C++ exception, like bad_alloc and various user define exception?


    thanks in advance,
    George

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Moved to Win32.

    Structured exceptions are a Win32-specific thing.

    C++ exceptions are a C++-specific thing.

    C++ exceptions carry an object. Structured exceptions carry just a code. SEH has finally blocks. SEH allows continuation.

    Most Win32 compilers implement C++ exceptions using SEH.

    That's it, pretty much. The purpose is the same.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks CornedBee,


    I also read some structured exception tutorials, especially this one I think is perfect,

    http://www.microsoft.com/msj/0197/Ex...Exception.aspx

    1.

    I think structured exception is totally different from C++ exception, even if the purpose and the logics are the same, right?

    Previously, I mis-understand that structured exception is a special kind of C++ exception, which is wrong.

    2.

    Why in normal code and API document (like MSDN ones), I have almost never seen structured exception and only see almost all are C++ exception?


    regards,
    George

    Quote Originally Posted by CornedBee View Post
    Moved to Win32.

    Structured exceptions are a Win32-specific thing.

    C++ exceptions are a C++-specific thing.

    C++ exceptions carry an object. Structured exceptions carry just a code. SEH has finally blocks. SEH allows continuation.

    Most Win32 compilers implement C++ exceptions using SEH.

    That's it, pretty much. The purpose is the same.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by George2 View Post
    I think structured exception is totally different from C++ exception, even if the purpose and the logics are the same, right?
    They are two completely distinct things, if that's what you mean.

    Why in normal code and API document (like MSDN ones), I have almost never seen structured exception and only see almost all are C++ exception?
    I've never seen a C++ exception in the WinAPI documentation. Only in the documentation of the C++ standard library. Which makes sense.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks CornedBee,


    Quote Originally Posted by CornedBee View Post
    I've never seen a C++ exception in the WinAPI documentation. Only in the documentation of the C++ standard library. Which makes sense.
    So you mean you see some structured exception in WinAPI? Could you send me a sample MSDN link please? :-)


    regards,
    George

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. Try-catch works with structured exception
    By George2 in forum C++ Programming
    Replies: 22
    Last Post: 01-27-2008, 04:25 AM
  4. Handle C++ exception and structured exception together
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2008, 09:21 PM
  5. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM