From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7e29322ee367c19d X-Google-Attributes: gid103376,public From: "James S. Rogers" Subject: Re: Unchecked_Conversion on different sized types -- problem? Date: 2000/01/13 Message-ID: <85luaa$chr$1@bgtnsc03.worldnet.att.net>#1/1 X-Deja-AN: 572368140 References: <85lht1$l8c$1@nnrp1.deja.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc03.worldnet.att.net 947813514 12859 12.74.129.237 (14 Jan 2000 01:31:54 GMT) Organization: AT&T WorldNet Services NNTP-Posting-Date: 14 Jan 2000 01:31:54 GMT Newsgroups: comp.lang.ada Date: 2000-01-14T01:31:54+00:00 List-Id: Mike Silva wrote in message ... > >Jim Rogers wrote in message <85lht1$l8c$1@nnrp1.deja.com>... >> >> The simple solution to this is to declare a set of integer constants, >>not enumerated types. The constants will require no conversions at >>all. > > >Let me ask this then: what value is it to be able to specify the >representation of an enumeration? It seems to me that when you do this you >always want, at some point, to "get at" the value of an enumeration. Maybe >the crux of my question (or confusion) is that while enumeration >representations are allowed, there doesn't seem to be any clean way to use >them (assuming that anything called "Unchecked_" isn't "clean"). > >Mike There is nothing "unclean" about unchecked conversions. Use them as needed, but use them with care. Uncheccked simply means that you will not get a lot of help from the compiler in doing the "right thing". If you convert values that really do not map well, the compiler may give you a warning, but will not prevent you. My solution was another approach that often ends up being simpler. Sometimes it is even more efficient. I did not mean to imply that the use of Unchecked_Conversion was in any way intrinsically bad. The use of enumeration representation is often useful when you need to follow a communication protocol. When you write the stream representation of the enumeration value you will get close to the value you expect. If you use the GNAT compiler you will get the value you expect. Jim Rogers Colorado Springs, Colorado