From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 23:10:25 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C446816A4CE for ; Wed, 22 Dec 2004 23:10:25 +0000 (GMT) Received: from blackwater.lemis.com (wantadilla.lemis.com [192.109.197.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 59A5043D54 for ; Wed, 22 Dec 2004 23:10:22 +0000 (GMT) (envelope-from grog@lemis.com) Received: by blackwater.lemis.com (Postfix, from userid 1004) id 04B1385605; Thu, 23 Dec 2004 09:40:13 +1030 (CST) Date: Thu, 23 Dec 2004 09:40:12 +1030 From: Greg 'groggy' Lehey To: Peter Edwards Message-ID: <20041222231012.GB53357@wantadilla.lemis.com> References: <20041222010143.GS53357@wantadilla.lemis.com> <20041222090855.GO79646@cirb503493.alcatel.com.au> <20041222103844.GI801@straylight.m.ringlet.net> <34cb7c8404122205002bd7de18@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mjeOt6n4R71vn6wN" Content-Disposition: inline In-Reply-To: <34cb7c8404122205002bd7de18@mail.gmail.com> User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 cc: Peter Jeremy cc: FreeBSD Architecture Mailing List Subject: Re: Header files with enums instead of defines? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2004 23:10:25 -0000 --mjeOt6n4R71vn6wN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --mjeOt6n4R71vn6wN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFByf7UIubykFB6QiMRAqR6AKCFEUPE0IPTIKYzAF6t7c1NqeDMeQCfYkbc 3HJRX0PCoLBk5PAWbbjQYBs= =0A15 -----END PGP SIGNATURE----- --mjeOt6n4R71vn6wN--