Thread: C++ Exceptions

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    C++ Exceptions

    I had a problem with my new used PC. It gave me a Windows exception: In page error. Before that I didn't know about Windows Exceptions. But I studied it and read about structured exception handling. A Windows program throws an exception using API call RaiseException(). The code embraced in a _try block in MSVC then catches the error. Microsoft has added this functionality to its compiler for Windows exceptions. I don't know about other compilers (Borland, etc). How they handle Win Exceptions?

    I also want to know if C++ exceptions use some OS fascility or not, compiler handles exception mechanism code by itself.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Could you give us the exact error code. "In page error" is not a regular error message. It may have got lost in translation somehow.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by siavoshkc View Post
    I had a problem with my new used PC. It gave me a Windows exception: In page error.
    Like matsp, I have no idea what an "In page error" means. Clarification needed.
    Quote Originally Posted by siavoshkc View Post
    Before that I didn't know about Windows Exceptions. But I studied it and read about structured exception handling. A Windows program throws an exception using API call RaiseException(). The code embraced in a _try block in MSVC then catches the error. Microsoft has added this functionality to its compiler for Windows exceptions. I don't know about other compilers (Borland, etc). How they handle Win Exceptions?
    You'll have to read the documentation for particular compilers. The way that different compilers have handled "Win Exceptions" (more properly known as "Structured Exceptions" under windows) varies with both compilers and compiler versions.
    Quote Originally Posted by siavoshkc View Post
    I also want to know if C++ exceptions use some OS fascility or not, compiler handles exception mechanism code by itself.
    That's actually a bit of a non-question.

    Most (I won't say "all", as I'm not sure about older versions) versions of Microsoft compilers implement C++ error handling using windows Structured Exception Handling (SEH) techniques. However, that works by the compiler translating try/catch blocks into API calls related to SEH that are interspersed at relevant points in code. Either way, the compiler still has to generate code to raise an exceptions and other code to catch/handle them.

    There is no requirement that compilers use SEH to implement C++ exception handling, or even that they give compatibility (as far as the programmer is concerned) between SEH and C++ exception handling. In practice, however, compilers targeting windows applications will probably do something with SEH.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    "In page error (c0000006)" is one of Win32 exceptions. Just like Access violation (c000005). You can see it in MSVC++ 2008 >> Debug >> Exceptions >> (in tree view) Win32 Exceptions

    I forgot to say that the cause of problem was bad IDE cable. I had to put the dump file in my other PC with MSVC installed to find the exact error code. It was strange that it worked fine in Windows safe mode. I really had a hard time to diagnose it. I diagnose many PCs. But most strange problems always happen on my own PC.

    Thank you grumpy for info.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  5. #5
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    Quote Originally Posted by siavoshkc View Post
    I also want to know if C++ exceptions use some OS fascility or not, compiler handles exception mechanism code by itself.
    As you're using VS, here's how it manages exceptions of both kinds.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  2. Exceptions that should terminate. Really.
    By Mario F. in forum C++ Programming
    Replies: 7
    Last Post: 06-26-2007, 10:56 AM
  3. Need advice: catch exceptions or call methods to check bits?
    By registering in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2003, 01:49 PM
  4. causing default exceptions to throw additional info
    By lightatdawn in forum C++ Programming
    Replies: 14
    Last Post: 08-06-2003, 06:39 PM
  5. Throwing exceptions with constructors
    By nickname_changed in forum C++ Programming
    Replies: 14
    Last Post: 07-08-2003, 09:21 AM

Tags for this Thread