Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: Are enums safe to use in portable code? Message-ID: <575@taumet.com> Date: 31 Jan 91 16:50:29 GMT References: <22898@well.sf.ca.us> <1991Jan30.210255.16804@csrd.uiuc.edu> Organization: Taumetric Corporation, San Diego Lines: 15 bliss@sp64.csrd.uiuc.edu (Brian Bliss) writes: > The alliant fx C compiler (for an fx1 or fx8, not fx2800), supports > them, but gives errors when you try to compare two enum constants. Enums are well-defined and safe in standard (ANSI/ISO) C. However, enums were introduced helter-skelter by different vendors years earlier, with no written standard to refer to. Apart from compiler bugs, different implementors had different ideas of how enums should work. At least one vendor did not allow an enum to index an array, for example. So if you need to port code among lots of pre-standard or non-standard compilers, it is probably best not to use enums. -- Steve Clamage, TauMetric Corp, steve@taumet.com