Date: Thu, 23 Dec 2004 09:40:12 +1030 From: Greg 'groggy' Lehey <grog@FreeBSD.org> To: Peter Edwards <peadar.edwards@gmail.com> Cc: FreeBSD Architecture Mailing List <arch@freebsd.org> Subject: Re: Header files with enums instead of defines? Message-ID: <20041222231012.GB53357@wantadilla.lemis.com> In-Reply-To: <34cb7c8404122205002bd7de18@mail.gmail.com> References: <20041222010143.GS53357@wantadilla.lemis.com> <20041222090855.GO79646@cirb503493.alcatel.com.au> <20041222103844.GI801@straylight.m.ringlet.net> <34cb7c8404122205002bd7de18@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Wednesday, 22 December 2004 at 13:00:50 +0000, Peter Edwards wrote:
>> The Single Unix Specification goes to great pains to repeat over and
>> over again that the error codes are 'symbolic constants', which IMHO
>> may be taken to mean either a #define'd macro or an enum value.
>> I, too, went to check with more than half a hunch that it would mandate
>> that the error codes be macros, but it turned out it doesn't :)
>
> But "errno" itself is "int", so even if the constants for the
> individual errno values were defined by an enumeration, that type
> information would be lost to the debugger when looking at errno
> itself, defeating the original benefit of having the symbolic names
> available in the debugger. As an alternative to Peter Jeremy's
> suggestion of using a GDB macro, you could, of course, define a type
> as:
> typedef enum {
> err_EPERM = EPERM,
> err_ENOENT = ENOENT,
> /* .... */
> } errno_t
Yes, that's what I ended up doing (for some definition of "err_"). It
still doesn't solve the more general issue of using enums instead of
#defines, but I don't suppose we will solve that one any time soon.
Greg
--
See complete headers for address and phone numbers.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
iD8DBQFByf7UIubykFB6QiMRAqR6AKCFEUPE0IPTIKYzAF6t7c1NqeDMeQCfYkbc
3HJRX0PCoLBk5PAWbbjQYBs=
=0A15
-----END PGP SIGNATURE-----
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041222231012.GB53357>
