Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!cmcl2!brl-adm!umd5!umbc3!alex From: alex@umbc3.UMD.EDU (Alex S. Crain) Newsgroups: comp.lang.c Subject: Re: Enum vs Define Message-ID: <447@umbc3.UMD.EDU> Date: Thu, 30-Jul-87 23:11:27 EDT Article-I.D.: umbc3.447 Posted: Thu Jul 30 23:11:27 1987 Date-Received: Sat, 1-Aug-87 15:07:52 EDT References: <19913@ucbvax.BERKELEY.EDU> Reply-To: alex@umbc3 (Alex S. Crain) Organization: University of Maryland, Baltimore County Lines: 30 >One hard won bit of knowledge for me is how the difference between >enums and defines can screw you up: > >in : > enum { > ERRMSGA = 1, > ERRMSGB = 2 > }; > ERRMSGA is defined to be a subtype of the smallest type that will >hold any of these enums. Since none of these enums are very large, >you'd expect: No, wait stop, enough. I like C. I find it gives me lots of freedom to work in and I believe that it is my responsibility as a programmer to write readable, maintainable code. if i felt that i needed the language to do it for me, i would use pascal or ada. Anyone who doesn't feel comfortable with an untyped language but for some reason must use C has my sympathies, but this is really getting out of hand. I remember reading somewhere that there is not a 'complete' ada compiler in existance because no-one can afford the disk space...this is why. the team that i work on has agreed among ourselves not to use enum, not to #define char int as 'byte', not to define { as begin and not to use TRUE as 1. we leave that to the guys upstairs using turbo-pascal. AAAA RRRR FFFFF Do what you want to do : You will anyway. AA AA RR RR FF AAAAAA RRRR FFFF If found wandering aimlessly, AA AA RR RR FF feed and return to: AA AA RR RR FF alex@umbc3.umd.edu