Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!cornell!uw-beaver!tektronix!cae780!hplabs!sdcrdcf!trwrb!scgvaxd!ashtate!dbase!awd From: awd@dbase.UUCP (Alastair Dallas) Newsgroups: comp.lang.c Subject: Enum vs Define Message-ID: <196@dbase.UUCP> Date: Fri, 19-Jun-87 18:50:38 EDT Article-I.D.: dbase.196 Posted: Fri Jun 19 18:50:38 1987 Date-Received: Mon, 22-Jun-87 06:36:45 EDT Organization: Ashton Tate Development Center Glendale Cal. Lines: 24 Keywords: enum, define This may sound like a beginner's question, but I don't consider myself a beginner: Why use enum instead of #define? For example, if I've got an array of error message strings indexed with ERRMSGA, ERRMSGB identifiers, isn't it more robust to explicitly define the values (which must correspond to the array) than to let the compiler do it? What are the tradeoffs involved between: enum { ERRMSGA = 1, ERRMSGB = 2 }; and #define ERRMSGA 1 #define ERRMSGB 2 I'm asking because it's unusual to find two ways to do the same thing that are effectively equal. Any comments? Alastair Dallas ASHTON-TATE Glendale These comments have nothing to do with my employer; I'm just curious.