comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: GNAT bug with respect to an Implementation Advise
Date: 13 Dec 2000 20:56:43 +0100
Date: 2000-12-13T20:56:43+01:00	[thread overview]
Message-ID: <87aea0xfgk.fsf@deneb.enyo.de> (raw)
In-Reply-To: t3f6rg54jlkfee@corp.supernews.com

"Jeff Creem" <jeff@thecreems.com> writes:

> The LRM has an implementation advice that says:
> 
> 13.13.2(17): Stream Oriented Attributes
> 
> If a stream element is the same size as a storage element, then the normal
> in-memory representation should be used by Read and Write for scalar
> objects. Otherwise, Read and Write should use the smallest number of stream
> elements needed to represent all values in the base range of the scalar
                                                 ^^^^^^^^^^
> type.

'base range' is crucial here.

> To which the GNAT RM says
> 
> Followed.

Correct.

> type My_Uint is range 0 .. 65535;
> for My_Uint'Size use 16;

My_Uint'Base'First is -2**31, and My_Uint'Base'Last is 2**31-1, I
think.

> The 'write on my_uint writes 32 bits not 16 bits. I realize that the
> 'write and 'size is an area where non-language lawyers get into
> trouble all the time but it sure seems to me as if GNAT is not
> following the IA.

GNAT is following the IA, but the IA is surprising.  There's also an
AI on this issue, which involved a lot of discussion.  (Some vendors
do not follow the IA and want to change the standard to officially
sanction the derivation, IMHO.



  reply	other threads:[~2000-12-13 19:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-13 15:53 GNAT bug with respect to an Implementation Advise Jeff Creem
2000-12-13 19:56 ` Florian Weimer [this message]
2000-12-14  0:49   ` Randy Brukardt
2000-12-14  1:40 ` Robert Dewar
2000-12-14  2:40   ` Jeff Creem
2000-12-14 22:47     ` Randy Brukardt
2000-12-15 22:00       ` Randy Brukardt
replies disabled

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