This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Exception handling in C.

Hello,

Can you please guide me to the common "Good Pratices" for exception handling in C. I am using Keil C Compiler DP8051 version 9.03.

Is there any library present to support exception handling here?

Thanks,
Rajender Mehta

Parents
  • What do you really mean here?

    C does not have exception handling as C++ has.

    There is a long-jump function that allows a function to return out of a function. But there is no stack unwind. No logic to get the functions in the call chain to perform any clean-up when the long-jump steps out of them unexpectedly.

    Or did you talk about processor exceptions, i.e. invalid opcodes, access to unmapped memory etc? That really doesn't have anything to do with the programming language. You have to decide yourself, if you should reset your hardware and start from beginning, or if you known without a doubt why you got there and if it would be safe to perform just a simple "repair" and then continue.

Reply
  • What do you really mean here?

    C does not have exception handling as C++ has.

    There is a long-jump function that allows a function to return out of a function. But there is no stack unwind. No logic to get the functions in the call chain to perform any clean-up when the long-jump steps out of them unexpectedly.

    Or did you talk about processor exceptions, i.e. invalid opcodes, access to unmapped memory etc? That really doesn't have anything to do with the programming language. You have to decide yourself, if you should reset your hardware and start from beginning, or if you known without a doubt why you got there and if it would be safe to perform just a simple "repair" and then continue.

Children
No data