trapping divide-by-zero - Windows CE

This is a discussion on trapping divide-by-zero - Windows CE ; We are using structured exception handling (SEH) at a very high level to trap hardware signals like divide-by-zero and dereferencing a NULL pointer. Apparently Microsoft accomplishes this by trapping the hardware signals at a very low level and then throwing ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: trapping divide-by-zero

  1. trapping divide-by-zero

    We are using structured exception handling (SEH) at a very high level
    to trap hardware signals like divide-by-zero and dereferencing a NULL
    pointer. Apparently Microsoft accomplishes this by trapping the
    hardware signals at a very low level and then throwing them as SEH
    exceptions. Unfortunately if we use SEH, we must turn off stack
    unwinding /GX, which limits our use of C++ exception handling. Also,
    apparently there is either a compiler extension -- or bug -- that
    allows hardware signals to be caught using catch(...) when building
    with Visual C++6. However, our experiments show that this DOES NOT
    work on WinCE apps built with EVC. Any experience with this?

    Essentially the problem is that we can not allow the screen (app) to
    just freeze if there is a bug in the code like divide-by-zero or
    dereferencing a NULL pointer. They want to be able to display some
    kind of message to the user instead of the screen just freezing.

    So, is there any other way besides using SEH to trap hardware signals?
    Maybe something we can do in the BSP? I'd really like to be able to
    use C++ exception handling. Also, do you know what the performance hit
    would be if we were able to turn on stack unwinding?

    Thanks,
    Andy


  2. Re: trapping divide-by-zero

    Have you tried __try, __finally, __leave? I don't know if this would
    work on WinCE.


+ Reply to Thread