From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 01:43:16 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from green.homeunix.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 509E016A4CE; Wed, 22 Dec 2004 01:43:16 +0000 (GMT) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.1/8.13.1) with ESMTP id iBM1hFS7095379; Tue, 21 Dec 2004 20:43:15 -0500 (EST) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.1/8.13.1/Submit) id iBM1hEot095378; Tue, 21 Dec 2004 20:43:15 -0500 (EST) (envelope-from green) Date: Tue, 21 Dec 2004 20:43:14 -0500 From: Brian Fundakowski Feldman To: "Greg 'groggy' Lehey" Message-ID: <20041222014314.GB41996@green.homeunix.org> References: <20041222010143.GS53357@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041222010143.GS53357@wantadilla.lemis.com> User-Agent: Mutt/1.5.6i 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 01:43:16 -0000 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. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\