From: Martin Krischik <martin@krischik.com>
Subject: Re: setting 'Size and unchecked conversion safe here?
Date: Sat, 12 Feb 2005 15:57:18 +0100
Date: 2005-02-12T15:57:18+01:00 [thread overview]
Message-ID: <1390368.LNTfKyOIbW@linux1.krischik.com> (raw)
In-Reply-To: mailman.137.1108214885.527.comp.lang.ada@ada-france.org
Marius Amado Alves wrote:
>
> On 12 Feb 2005, at 06:55, Martin Krischik wrote:
>
>> Marius Amado Alves wrote:
>>
>>>> ARM 13.9(5 .. 11) says
>>>> "If all of the following are true,
>>>> ...
>>>> S'Size = Target'Size
>>>
>>> I know. This happens, because I forced the access type to be 64-bit,
>>> same as the modular. What I'm not sure about is whether the unused 32
>>> bits are harmless or not (by definition). Thanks.
>>
>> There are not harmless since there is no requironment to set them to
>> 16#0000000#.
> If there were such a requirement is there a simple way to specify it?
A combination of checked and unchecked convertions. First an unchecked
convertion to an access compatible modular type:
http://en.wikibooks.org/wiki/Programming:Ada:Types:access#where_is_void.2A.3F
then a checked convertion to the 64 bit type.
>> In order to help you we have to know why it is that the access is 32
>> bit and
>> the modular 64. I can only guess it is for some compatiblity reason -
>> but
>> what do you need to keep compatible?
>
> The access type is 32 bits because the compiler says so.
> The modular 64 is my choice to represent small values (integers,
> floats, tiny strings, access values) in the vertices of a Mneson graph:
>
> type Vertex is record
> Tip : Natural_16;
> Cue : Modular_64;
> end record;
> for Vertex'Size use 80;
> pragma Pack (Vertex);
>
> I know this might be incompatible with some unusual architectures but
> I'm prepared to deal with that when and if the time comes.
I would use a variant record:
http://en.wikibooks.org/wiki/Programming:Ada:Types:record#Variant_Record
But that's is just me - and may not be suitable for your database.
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
next prev parent reply other threads:[~2005-02-12 14:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-11 18:52 setting 'Size and unchecked conversion safe here? Marius Amado Alves
2005-02-11 19:08 ` Martin Krischik
2005-02-11 20:34 ` tmoran
2005-02-11 22:37 ` Marius Amado Alves
2005-02-11 23:49 ` tmoran
2005-02-12 13:10 ` Marius Amado Alves
2005-02-12 6:55 ` Martin Krischik
2005-02-12 13:30 ` Marius Amado Alves
2005-02-12 14:57 ` Martin Krischik [this message]
2005-02-12 16:03 ` Marius Amado Alves
2005-02-12 16:04 ` Marius Amado Alves
2005-02-11 23:38 ` Robert A Duff
2005-02-12 12:46 ` Marius Amado Alves
2005-02-12 18:05 ` tmoran
2005-02-12 18:29 ` Marius Amado Alves
2005-02-12 19:14 ` Robert A Duff
2005-02-12 19:48 ` Marius Amado Alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox