Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (JAMES ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: const enums -- Lawyers opinions?? Keywords: const, enum Message-ID: <10231@microsoft.UUCP> Date: 11 Jan 90 17:51:38 GMT References: <963@rna.UUCP> <10197@microsoft.UUCP> <9925@ardent.UUCP> Reply-To: jimad@microsoft.UUCP (JAMES ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 23 >The question of what an enum type "really is", has bedeveled >the concept ever since it was introduced into C. Over the >years a lot has been said, but I believe a consensus finally >emerged and both ANSI C and the most recent C++ reference manual agree >that they are integral types. > >This means that its perfectly sensible to assign arbitrary integer >values to variables of enum type. Hm, are you saying this has changed recently? In my [not very new] reference manual appendix B pg 109 says: enum e { A }; sizeof(A) equals sizeof(e), which need not equal sizeof(int) [unlike ANSI-C] For example, it would not be unreasonable for some compiler on some machine to choose to represent small enums in a byte, in which case assigning an int to such an enum could lead to an unexpected truncation. "Integral" is not the same as "integer." Or has this changed?