From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 10:38:47 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 E1B8616A4CE for ; Wed, 22 Dec 2004 10:38:47 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 53A2043D45 for ; Wed, 22 Dec 2004 10:38:46 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 12370 invoked from network); 22 Dec 2004 10:38:41 -0000 Received: from unknown (HELO straylight.ringlet.net) (213.16.36.118) by gandalf.online.bg with SMTP; 22 Dec 2004 10:38:41 -0000 Received: (qmail 80577 invoked by uid 1000); 22 Dec 2004 10:38:44 -0000 Date: Wed, 22 Dec 2004 12:38:44 +0200 From: Peter Pentchev To: Peter Jeremy Message-ID: <20041222103844.GI801@straylight.m.ringlet.net> Mail-Followup-To: Peter Jeremy , Greg 'groggy' Lehey , FreeBSD Architecture Mailing List References: <20041222010143.GS53357@wantadilla.lemis.com> <20041222090855.GO79646@cirb503493.alcatel.com.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hABqaeELJqnDDeDE" Content-Disposition: inline In-Reply-To: <20041222090855.GO79646@cirb503493.alcatel.com.au> User-Agent: Mutt/1.5.6i cc: Greg 'groggy' Lehey 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 10:38:48 -0000 --hABqaeELJqnDDeDE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 22, 2004 at 08:08:55PM +1100, Peter Jeremy wrote: > On Wed, 2004-Dec-22 11:31:43 +1030, Greg 'groggy' Lehey wrote: > >Has anybody thought about replacing #defines with enums in header > >files? It would make debugging a whole lot easier. Foe example, I'm > >currently looking at a debug printout which contains: > > > > xerrno =3D 17,=20 > ... > > xerrno =3D EEXIST,=20 >=20 > K&R2 states that errno is an "integer expression" and that the error > values are "macros". I suspect POSIX and newer C standards say something > similar. 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 :) Still, all the other objections about enums not really being ints are quite valid :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 If you think this sentence is confusing, then change one pig. --hABqaeELJqnDDeDE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFByU607Ri2jRYZRVMRAm9tAJ9U3h/IdMYLWhA2M9Uc5uKe0v4atQCfaRYn 4auVXtjQTYzr2FswtmUTkAk= =8Xtm -----END PGP SIGNATURE----- --hABqaeELJqnDDeDE--