From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: 'size works for SunAda but not GNAT
Date: 1996/10/09
Date: 1996-10-09T00:00:00+00:00 [thread overview]
Message-ID: <325B9E3B.4AD9@gsfc.nasa.gov> (raw)
In-Reply-To: 53dv03$3ti@gcsin3.geccs.gecm.com
David Haslam wrote:
>
> I have a lot of code like this, which compiles fine
> with SunAda 1.1:
>
> subtype V is integer range 0..63;
> type A is array (1..9) of V;
> for A'size use 9 * 8;
>
> GNAT complains "size for A must be at least 288".
> GNAT wants V to be 32 bits, even though it can fit in 8.
>
> If GNAT is correct in rejecting this, then it implies that the
> code we have is non-portable (and relied on a Verdix implementation
> dependent feature).
Well, non-portable between Ada83 and Ada95, at least. Although, I
suspect there are other Ada83 compilers that reject this also.
> If so, how do I write portable rep clauses?
> There are two ways of fixing the code for GNAT:
> 1. use a type instead of a subtype
> 2. add the line: "for A'component_size use 8;"
>
These are certainly good choices; 2 is not Ada83, but it is standard
Ada95 (note that not all attributes GNAT supports are standard Ada95).
> Which of these is better?
If you want Ada83 portability, you have to pick 1. If you can use Ada95,
1 is better if ALL uses of type V must be 8 bits; 2 is better if only
THIS use of V needs 8 bits.
>
> --
> David Haslam Work: David.Haslam@gecm.com
> GEC-Marconi S3I Ltd Home: dch@sirius.demon.co.uk
> Simulation and Training Division
--
- Stephe
next prev parent reply other threads:[~1996-10-09 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-08 0:00 'size works for SunAda but not GNAT David Haslam
1996-10-09 0:00 ` Robert Dewar
1996-10-09 0:00 ` Stephen Leake [this message]
1996-10-11 0:00 ` Alan Brain
1996-10-11 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox