From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 04:29:56 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 2DA4E16A4CF; Wed, 22 Dec 2004 04:29:56 +0000 (GMT) Received: from athena.softcardsystems.com (mail.softcardsystems.com [12.34.136.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F38043D54; Wed, 22 Dec 2004 04:29:55 +0000 (GMT) (envelope-from sah@softcardsystems.com) Received: from athena (athena [12.34.136.114])iBM5OGVS019581; Wed, 22 Dec 2004 00:24:16 -0500 Date: Wed, 22 Dec 2004 00:24:16 -0500 (EST) From: Sam X-X-Sender: sah@athena To: "Greg 'groggy' Lehey" In-Reply-To: <20041222020308.GX53357@wantadilla.lemis.com> Message-ID: References: <20041222010143.GS53357@wantadilla.lemis.com> <20041222020308.GX53357@wantadilla.lemis.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 04:29:56 -0000 > On Tuesday, 21 December 2004 at 20:43:14 -0500, Brian Fundakowski Feldman wrote: >> On Wed, Dec 22, 2004 at 11:31:43AM +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 = 17, >>> >>> To find out what that means, I need to go to >>> /usr/src/include/sys/errno.h and look for 17. I find: >>> >>> #define EEXIST 17 /* File exists */ >>> >>> If we were to change this to >>> >>> enum EEXIST = 17; /* File exists */ >>> >>> I'd then be able to see: >>> >>> xerrno = EEXIST, >>> >>> That makes debugging a whole lot easier. About the only down side I >>> can see is that you can't #undef an enum. Is this a big deal? >> >> I think you'll screw up an awful lot of people that #ifdef based upon >> the errno names. > > *sigh* Yes, I didn't think about that. Never mind. Seems a shame to forgo utility to avoid breaking a fragile assumption. Maybe an ifdef ERRNO_T in errno.h that defines an enum errno_t instead? Sam