"andrew queisser" <andrew.queisser at hp com> wrote
>
> I'm working on a small embedded system (think microcontroller with
> uC/OS-II) and I'm considering which convention to use for error handling
> in our internal "API". Since I'm using two existing APIs (a low-level HAL
> and the OS API) I already have mixed conventions since some return 0 for
> failure, some return 0 for "no-error", etc.
>
> Comments? Suggestions?
>
There is no easy solution tot he problem of errors.
You need one type when debugging, another type when distributing beta type
code to users, and a third type when you know the code itself is robust but
input may not be.
Sometimes you want code to be reusable, and sometimes you wnat a centralised
list of error codes. You can't have both.
One mistake the designer of the standard libary made was not to have any way
of querying the line number of an input file from its file pointer.
That would be one recommendation if you are doing IO from scratch,
preseuming your input is text which could potentially be corrupted.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $6.90 paper, available
www.lulu.com