comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Size of 0..255 is not 8 bits?
Date: 1998/05/15
Date: 1998-05-15T00:00:00+00:00	[thread overview]
Message-ID: <Et0oJu.G8y.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 355C574F.3BA43583@hso.link.com


As was finally pointed out, this is an issue with the
stream representation of a subtype (i.e. what S'Read and S'Write do), 
not a problem with S'Size or with the size of objects.

As defined by the RM, S'Base'Size is what matters for S'Read and
S'Write, not S'Size.  This is probably a mistake, since S'Base'Size
is not necessarily portable, nor quite what is wanted.  We are
currently discussing in the "Ada Rapporteur Group" (ARG) making
a language change in this area.

One possible change would be to make the stream representation 
for a scalar type use the smallest number of stream elements
per item needed to include the range of the *first* subtype,
rather than the *base* subtype of the type.  This means that
certain values that are within the base range of the type might
not be writable with 'Write, but that seems better than the
current situation where the stream representation is non-portable,
and often non-intuitive.

As this example points out, it will be important to decide what 
happens with signed integer types whose first subtype has no negative 
values.  Probably the representation will be based on the value of
S'Size, which in a case like this, is clearly defined to be 8.
Presuming the size of a stream element is 8, then a scalar type whose
first subtype has 'Size of 8 would use just one stream element per
item.

In any case, this is all just speculation at this point, because the
ARG hasn't agreed on how to resolve this issue, or whether to propose
any language change at all.  However, this news thread indicates
that this problem is important to solve sooner rather than later.

-Tucker Taft  stt@inmet.com




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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-14  0:00 Size of 0..255 is not 8 bits? Markus Kuhn
1998-05-13  0:00 ` Matthew Heaney
1998-05-14  0:00   ` Tom Moran
1998-05-14  0:00   ` Robert Dewar
1998-05-14  0:00   ` Markus Kuhn
1998-05-14  0:00     ` Robert Dewar
1998-05-14  0:00       ` Simon Pilgrim
1998-05-15  0:00       ` Joe Gwinn
1998-05-16  0:00         ` Robert Dewar
1998-05-17  0:00           ` Joe Gwinn
1998-05-15  0:00       ` Markus Kuhn
1998-05-15  0:00         ` Samuel T. Harris
1998-05-15  0:00           ` Tucker Taft [this message]
1998-05-14  0:00     ` John McCabe
1998-05-14  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