From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: 83/95 issue, bad code or compiler bug
Date: 1998/11/20
Date: 1998-11-20T00:00:00+00:00 [thread overview]
Message-ID: <matthew_heaney-ya023680001911981825510001@news.ni.net> (raw)
In-Reply-To: jeffrey.m.creem-1911981641480001@ljd155.sanders.lmco.com
In article <jeffrey.m.creem-1911981641480001@ljd155.sanders.lmco.com>,
jeffrey.m.creem@lmco.com (Jeff Creem) wrote:
>type My_Integer_Type is range -2**31 .. 2**31-1;
>for My_Integer_Type'size use 32;
Please use the types in package Interfaces; either Interfaces.Integer_32 or
Interfaces.Unsigned_32.
>subtype My_Subtype is My_Integer_Type range 0 .. 255;
>
>
>type My_Record is
> record
> My_Field : My_Subtype;
> Other_Field : My_Integer_Type;
> end record;
>
>for My_Record use
> record
> My_Field at 0 range 0 .. 31;
> Other_Field at 4 range 0 .. 31;
> end record;
>
>for My_Record'size use 2 * 32;
>
This is bad style. For low-level I/O --here, meaning anything that appears
as the component of a record with a rep clause-- all scalar types should
have no constraints. In your example, My_Field should be of type
My_Interger_Type (Interfaces.Integer_32), not My_Subtype.
>Is this due to the Ada 83 code being written in a poor totally unportable way,
>or is this permitted and expected in Ada 95 or is this a compiler bug (GNAT
>does not exhibit this "bad" behaviour on my code but it certainly could
>be that the code as written will have implementation defined results).
Don't mix rep clauses and types-with-constraints.
next prev parent reply other threads:[~1998-11-20 0:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-19 0:00 83/95 issue, bad code or compiler bug Jeff Creem
1998-11-19 0:00 ` Tom Moran
1998-11-19 0:00 ` Tucker Taft
1998-11-19 0:00 ` Corey Ashford
1998-11-19 0:00 ` Corey Ashford
1998-11-20 0:00 ` Matthew Heaney [this message]
1998-11-20 0:00 ` Tom Moran
1998-11-20 0:00 ` Tom Moran
1998-11-21 0:00 ` dewarr
1998-11-22 0:00 ` Tom Moran
1998-11-23 0:00 ` dewarr
1998-11-24 0:00 ` Tom Moran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox