comp.lang.ada
 help / color / mirror / Atom feed
From: "James S. Rogers" <jimmaureenrogers@worldnet.att.net>
Subject: Re: Unchecked_Conversion on different sized types -- problem?
Date: 2000/01/13
Date: 2000-01-14T01:31:54+00:00	[thread overview]
Message-ID: <85luaa$chr$1@bgtnsc03.worldnet.att.net> (raw)
In-Reply-To: Slsf4.440$dw3.15342@news.wenet.net


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






  reply	other threads:[~2000-01-13  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-13  0:00 Unchecked_Conversion on different sized types -- problem? Mike Silva
2000-01-13  0:00 ` Bryce Bardin
2000-01-13  0:00   ` Mike Silva
2000-01-13  0:00     ` Mike Silva
2000-01-14  0:00       ` Bryce Bardin
2000-01-14  0:00         ` Mike Silva
2000-01-14  0:00   ` Matthew Heaney
2000-01-13  0:00 ` Jim Rogers
2000-01-13  0:00   ` Mike Silva
2000-01-13  0:00     ` James S. Rogers [this message]
2000-01-13  0:00 ` reason67
2000-01-14  0:00 ` Jeff Carter
2000-01-14  0:00 ` Keith Thompson
2000-01-16  0:00   ` David A. Cobb
2000-01-14  0:00 ` Vladimir Olensky
2000-01-14  0:00 ` Wrap-Up (was Re: Unchecked_Conversion on different sized types -- problem?) Mike Silva
2000-01-15  0:00   ` Matthew Heaney
2000-01-15  0:00     ` Robert A Duff
2000-01-14  0:00 ` Unchecked_Conversion on different sized types -- problem? Werner Pachler
2000-01-14  0:00   ` reason67
2000-01-14  0:00   ` Bryce Bardin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox