Date: Wed, 22 Dec 2004 11:31:43 +1030 From: Greg 'groggy' Lehey <grog@FreeBSD.org> To: FreeBSD Architecture Mailing List <arch@FreeBSD.org> Subject: Header files with enums instead of defines? Message-ID: <20041222010143.GS53357@wantadilla.lemis.com>
next in thread | raw e-mail | index | archive | help
--ceuyUbi+oA5bUa/n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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=20 enum EEXIST =3D 17; /* File exists */ I'd then be able to see: xerrno =3D EEXIST,=20 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? Greg -- See complete headers for address and phone numbers. --ceuyUbi+oA5bUa/n Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFByMd3IubykFB6QiMRAsqsAKCdn6bk1DLHe42IG/A60WA0zsb2zwCgtBzs EKAabKQs9Be0pFp64FF86hM= =ky4I -----END PGP SIGNATURE----- --ceuyUbi+oA5bUa/n--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041222010143.GS53357>