Hi all, I've lurked for a while, but this is my first time posting. I'm somewhat new to the software engineering/software design world, and I'm currently wrangling with the problem of how to track, propagate, and report errors in my embedded C code. Unfortunately Google is almost impossible to search for C-specific stuff, and I can't find any decent guides out there. So my software has an overall module with several layers of lower-level quasi-independent sub-modules. I need to be able to flag errors at any of these levels and report them up the chain to the top, where I can reset the system or report them over UART or whatever is necessary. But this is C, so I don't have the luxury of exceptions. The best I can tell, most people use either global variables (such as errno) or return codes to flag errors within each function, then check for those errors once the function returns. Then the upper-level function can take the appropriate action and return its own error, etc. At my lowest-level module, I could have an enum like: enum lib1ErrorCodes { LIB1_ERR_NO_ERROR, LIB1_ERR_NO_CONNECTION, ... LIB1_ERR_MISC }; and the same for other modules at the same level. But it seems as if I'd need to actively manage the actual codes for this: enum lib1ErrorCodes { LIB1_ERR_FOO = 1, ... }; enum lib2ErrorCodes { LIB2_ERR_BAR = 101, ... }; What happens if I include a third-party module that has its own codes? Rewrite mine around those? I'd also need to include the entire source tree into the top-level module so I'd be able to access the codes for each sub-module. Is there some overall solution out there people are happy with that I just haven't stumbled upon yet? -- Joel J. K. Parker Systems Engineer Radiance Technologies, Inc. (256) 655-2463 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist