Header files with enums instead of defines?

Peter Edwards peadar.edwards at gmail.com
Wed Dec 22 16:22:42 PST 2004


> 
> Or better yet, just use the array of error values already compiled
> into the programs that strerror() formats for you (you don't need to
> use strerror, just sys_errlist[]).

I'd dispute the "better yet": If used in code, "errno_t" is useful in
its own right. Even beyond the type safety, if used in a structure

> (gdb) print *structptr

Will print errno_t members properly, without requiring hints that
fields represent errno values, etc. (ie, it's a hint to the debugger
that something of type errno_t conveys more specific information than
a value between INT_MIN and INT_MAX.)
Although textual descriptions are better than the errno names to
users, "err_EBADF" means much more than "9" in a debug output to the
programmer running the debugger.

Sorry for splitting hairs. (But the bikeshed should definitely be blue)
-- 
Peadar.


More information about the freebsd-arch mailing list