Enumerated types... what's the point?

D. K. Smith dks at shumv1.uucp
Thu Mar 22 15:31:48 AEST 1990


I thought... How nice!  These enumaerated types allow me "type check"
myself when I am using them for distinguishing between different
variable types that possess similar data structures.

For example:

typedef enum {
	subjPoly=0,
	clipPoly
} PolyKind;
	 
	  
typedef enum {
	insidePoly=0,
	outsidePoly
} DisplayKind;


However, to my surprise, I discovered that I could interchange these
critters among themselves as well as with Booleans!  Is this what is
supposed to happen?  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.  

I guess I am supposed to conclude that an int is an int is an int... no
matter what kind of label you put on it?!?


dk smith
------------------------------------------------------------------------
dks at shumv1.ncsu.edu                |                ude.uscn.1vmuhs at skd
-my opinions reflect my opinions.  |  .snoinipo ym tcelfer snoinipo ym-
------------------------------------------------------------------------



More information about the Comp.lang.c mailing list