Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!mit-eddie!genrad!decvax!decwrl!pyramid!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c Subject: Re: Enum vs Define Message-ID: <2208@mmintl.UUCP> Date: Tue, 23-Jun-87 21:22:47 EDT Article-I.D.: mmintl.2208 Posted: Tue Jun 23 21:22:47 1987 Date-Received: Sat, 27-Jun-87 04:43:26 EDT References: <196@dbase.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT. Lines: 23 Keywords: enum, define In article <196@dbase.UUCP> awd@dbase.UUCP (Alastair Dallas) writes: >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? [i.e.] > enum { > ERRMSGA = 1, > ERRMSGB = 2 > }; This is a good example of a case where I would *not* put explicit constants in the enum. Suppose, having built a list of 100 error messages, the third one becomes irrelevant and is to be removed? This way, you have to either manually renumber 96 error messages, leave a hole in the table, or move another message down. Trying to make message files consistent from release to release is a fool's errand. -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108