comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Ada 95 Numerics questions for the experts
Date: 1997/09/02
Date: 1997-09-02T00:00:00+00:00	[thread overview]
Message-ID: <EFuzEH.62y@world.std.com> (raw)
In-Reply-To: dewar.873149493@merv


In article <dewar.873149493@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> wrote:
>Note that GNAT whereever possible follows the advice in the RM even if
>it causes portability troubles. A common example is the following
>
>  type arr8 is array (1..8) of boolean;
>  for arr8'size use 8;
>
>The RM permits the size clause to cause implicit packing, but recommends
>against it.

It would be pretty hard for the RM to do anything more than "recommend"
here.  After all, the compiler is allowed to use 1-bit components all
the time (even if that's not a good idea), or to use 1-bit components if
the program is compiled on a the first Tuesday of the month (an even
worse idea!), or to follow the phase of the moon.  Given that, how could
the RM do more than "recommend"?

>... VADS at least permitted this implicit packing (even though
>there was an AI that recommended against it).

One can't blame VADS *too* much.  The AI appeared after VADS had
implemented some particular mechanism.  Ada 95 merely codified the AI
into the RM.

>Consequently in GNAT, we reject the above, and require an explicit pragma
>Pack.

Or, presumably, a "for arr8'Component_Size use 1;".  Good.

>... The workdaround for existing code here is easy, and the code is
>arguably clearer with the pragma there in any case.
>
>However, if you have code that depends on close packed 3 bit components,
>you are completely up the creak if your compiler does not support it!

And, also unfortunately, the RM doesn't nail down what 3-bit components
would mean.  On a 32-bit machine, it might mean 10 3-bit components per
word, with a 2-bit wastage in each word, or it might mean 3-bit
components, crossing word boundaries, with no wastage.  Sigh.

I don't feel *too* bad about that -- other languages with similar
features (eg packed arrays in Pascal) are even less specific.

- Bob




  parent reply	other threads:[~1997-09-02  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3401C14B.480@gsfc.nasa.gov>
1997-08-25  0:00 ` Ada 95 Numerics questions for the experts Robert Dewar
     [not found] ` <dewar.872560585@merv>
     [not found]   ` <jcreem-2608970711210001@ljd155.sanders.lockheed.com>
     [not found]     ` <dewar.872630607@merv>
     [not found]       ` <jeffrey.m.creem-2708970802350001@ljd155.sanders.lockheed.com>
1997-08-27  0:00         ` Robert Dewar
     [not found]           ` <jeffrey.m.creem-2808970708260001@ljd155.sanders.lockheed.com>
1997-08-28  0:00             ` Robert Dewar
1997-08-27  0:00         ` David C. Hoos, Sr.
1997-08-27  0:00           ` Robert Dewar
1997-08-27  0:00           ` Jeff Creem
1997-08-28  0:00             ` Robert Dewar
1997-08-28  0:00               ` Jeff Creem
1997-08-29  0:00               ` Tucker Taft
1997-08-30  0:00                 ` Robert A Duff
1997-08-31  0:00                 ` Tom Moran
1997-09-01  0:00                 ` Robert Dewar
1997-09-02  0:00                   ` Fergus Henderson
1997-09-02  0:00                   ` Robert A Duff [this message]
     [not found]                   ` <mheaney-ya023680000209972104030001@news.ni.net>
1997-09-05  0:00                     ` Robert Dewar
1997-09-05  0:00                       ` Matthew Heaney
1997-09-08  0:00                         ` Robert A Duff
1997-09-08  0:00                           ` Matthew Heaney
1997-09-09  0:00                             ` Robert A Duff
     [not found]                     ` <EFxt94.F5F@world.std.com>
1997-09-06  0:00                       ` Robert Dewar
1997-09-08  0:00                         ` Robert A Duff
1997-09-08  0:00                           ` Matthew Heaney
1997-09-09  0:00                             ` Robert A Duff
1997-09-01  0:00                 ` Robert Dewar
1997-08-30  0:00         ` Robert A Duff
replies disabled

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