We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
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.