Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!tut!santra!hemuli.tik.vtt.fi!Markku.Savela From: Markku.Savela@tel.vtt.fi (Markku Savela) Newsgroups: comp.lang.c Subject: Re: Enumerated types... what's the point? Message-ID: <4617@hemuli.tik.vtt.fi> Date: 24 Mar 90 09:00:11 GMT References: <1990Mar22.053148.10351@ncsuvx.ncsu.edu> <1990Mar22.164943.10459@utzoo.uucp> Sender: news@hemuli.tik.vtt.fi Reply-To: savela@tel.vtt.fi (Markku Savela) Organization: Technical Research Centre of Finland Lines: 34 In-reply-to: henry@utzoo.uucp's message of 22 Mar 90 16:49:43 GMT >In article <1990Mar22.053148.10351@ncsuvx.ncsu.edu> dks@shumv1.ncsu.edu (D. K. Smith) writes: >>... I have not RTFM'd the C scriptures but my >>immediate reaction is "what's the point!...I could just as easily >>used #define and accomplished the same thing. There is one difference between #define and enum: you can do enum x { foo, bar, and, boo }; ... ... int oops(foo) char *foo; { ... } if you had "#define foo 0", you would at least get interesting error messages from the compiler, not always quite easy to fathom, unless you know to watch this situation... And, yes defining that kind of common names with #define is not healthy. I don't usually do it, but got bitten by this when I automaticly translated from Pascal to C (which converted Pascal CONST-declarations to #define's ;-) In a large program with many included header files, it took a while until I realized what the completely "bogus" error messages meant... -- Markku Savela | savela@tel.vtt.fi Technical Research Centre of Finland | Telecommunications Laboratory | Markku.Savela@vtt.fi Otakaari 7 B, SF-02150 ESPOO, Finland | savela%vtttel@router.funet.fi