Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rochester!rutgers!ames!amdcad!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Enum vs Define Message-ID: <24622@sun.uucp> Date: Fri, 31-Jul-87 13:34:40 EDT Article-I.D.: sun.24622 Posted: Fri Jul 31 13:34:40 1987 Date-Received: Sun, 2-Aug-87 02:52:36 EDT References: <19913@ucbvax.BERKELEY.EDU> <447@umbc3.UMD.EDU> Sender: news@sun.uucp Lines: 60 > 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. I'm sure lots of people feel they don't need the language to help them out when writing code; after the first few coding errors of theirs are caught by "lint" *before* they compile and run the program, they'll probably change their mind. (After having several kernel problems turned up by "lint", I know I'm convinced.) > > Anyone who doesn't feel comfortable with an untyped language but for > some reason must use C has my sympathies, Anyone who doesn't feel comfortable with a *typed* language but for some reason must use C has *my* sympathies; C *is* a typed language, and I believe a strongly-typed one (albeit with weak type checking). > 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. Because it has enumerated data types? Give me a break! First of all, I'm not sure I believe the assertion in question, and second of all, I don't believe that if no such compiler exists becasue "no-one can afford the disk space", it's not just because ADA is strongly typed! (Consider all the features ADA has: operator overloading, generics, etc., etc., etc..) There *do* exist strongly-typed languages with strong type-checking that *do* have complete compilers and that, according to at least some of their users, make their life easier for having strong type-checking. Mesa is one of them. > the team that i work on has agreed among ourselves not to use enum, Sounds like your team is cutting off their noses to spite their faces. I can think of three advantages to "enum" right off the bat: 1) Given the proper fixes to "lint", it can detect some coding mistakes at compile time. 2) Debuggers like "dbx" can print "enum"s much more meaningfully than they can print "int"s whose values are restricted, by convention, to a member of a set of #defines. 3) Many compilers (including most PCC-based ones) will automatically choose a reasonable size for an "enum" variable based on the largest and smallest numbers used to represent the values of that "enum". We use both "enum"s and "lint" here, at least in the group doing OS development. "lint"ing the kernel catches quite a few problems. Strong typing isn't for weak minds; the argument "strong typing is for weak minds" is for weak minds. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com