Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Dec 2004 00:22:41 +0000
From:      Peter Edwards <peadar.edwards@gmail.com>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        arch@freebsd.org
Subject:   Re: Header files with enums instead of defines?
Message-ID:  <34cb7c84041222162210f14238@mail.gmail.com>
In-Reply-To: <20041222.115155.71839775.imp@bsdimp.com>
References:  <34cb7c8404122205002bd7de18@mail.gmail.com> <20041222.113411.76074974.imp@bsdimp.com> <41C9C015.7050706@freebsd.org> <20041222.115155.71839775.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34cb7c84041222162210f14238>