comp.lang.ada
 help / color / mirror / Atom feed
From: Charles Hixson <charleshixson@earthling.net>
To: Mats.Weber@elca-matrix.ch
Subject: Re: Help needed in port to GNAT95 from verdix
Date: 1998/05/14
Date: 1998-05-14T00:00:00+00:00	[thread overview]
Message-ID: <355B319B.BAFDC332@earthling.net> (raw)
In-Reply-To: 355B227D.2858F2BD@elca-matrix.ch


It seems to me that I have been reading that it should be:
type Byte is -128..127;
or it won't fit into 8 bits, which certainly seems to be what you are
planning here.  Something about values requiring symmetry around 0?

Please let me know if I'm confused, as Ada is by no means my primary
language.

Mats Weber wrote:
> 
> Paul Hussein wrote:
> >
> > I do not understand  why a piece of code that works on verdix will not now
> > work an gnat95, and this is an important piece of code. If anyone could help
> > it would be most appreciated.
> 
> Because it contains assumptions about the 'Size of Float, and
> unchecked_conversion to/from an array of floats. Consider yourself lucky if
> this ports between different versions of the Verdix compiler.
> 
> > When I run this code sample, and the code itself  in our system I get a
> > constraint error.
> > This code endeavours to turn any type into an array of floats for passing
> > over the network.
> 
> A very bad idea. Not any sequence of bits is a valid float.
> 
> If you really have to convert to something, then use
> 
>    type Byte is 0 .. 255;
>    for Byte'Size use 8;
>    type Byte_Array is array (Positive range <>) of Byte;
>    pragma Pack(Byte_Array);
> 
> where any sequence of bits is a valid value.

-- 
Charles Hixson	charleshixson@earthling.net
(510) 464-7733	or chixso@mtc.dst.ca.us




  reply	other threads:[~1998-05-14  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-13  0:00 Help needed in port to GNAT95 from verdix Paul Hussein
1998-05-14  0:00 ` Mats Weber
1998-05-14  0:00   ` Charles Hixson [this message]
1998-05-14  0:00     ` Matthew Heaney
     [not found]     ` <Esyp0E.5q0@world.std.com>
1998-05-14  0:00       ` Robert Dewar
1998-05-15  0:00         ` Jean-Pierre Rosen
1998-05-16  0:00           ` Robert Dewar
1998-05-15  0:00         ` Larry Kilgallen
1998-05-19  0:00           ` John McCabe
1998-05-15  0:00 ` Niklas Holsti
replies disabled

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