Grouse: What's the point of enum?

Stephen Clamage steve at taumet.com
Sun Apr 21 06:30:33 AEST 1991


ts at cup.portal.com (Tim W Smith) writes:

>Anyway, the real point is to allow lower case names for constants.  If
>you try this in a header file...

"The" real point, eh?  Seems like we've have more than one good point
mentioned already, but I haven't seen this one yet:

Preprocessor defines have no scope.  They reach into the internals of
structs and functions and can result in mystifying error messages and
hard-to-find bugs.  The enumeration names are scoped, and can be made
local to functions if desired, and can be locally overridden inside
functions which don't know and don't want to know about a #define (or
enum) buried inside some nested include file.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list