comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Ada 95 Numerics questions for the experts
Date: 1997/09/01
Date: 1997-09-01T00:00:00+00:00	[thread overview]
Message-ID: <dewar.873149493@merv> (raw)
In-Reply-To: EFoIvv.JtA.0.-s@inmet.camb.inmet.com



Tuck said

<<As far as packing to an array of 3-bits per element versus 4-bits per
element, we have generally chosen to follow the recommendations of the
RM.  Going beyond the RM is not always in the customer's interest,
as they may have to move to another Ada compiler at some point, and
one of the goals of standardization is portability between implementations.>>

Tuck says "follow the recomendations" here where he means "follow the
minimal requirements". There is a big difference.

In this particular, case the RM recommendation is that the level of packing
(for 3-bit components) result in a component size less than or equal to 4.

GNAT chooses 3. Since 3 is (last time I looked) less than or equal to 4, 
GNAT is not "going beyond" the RM here, it is following the implementation
advice of the RM (and this IA is in fact a requirement, given that
GNAT supports Annex C).

If Tuck had wasnted the RM to recommend that the component size should
be exactly 4, he should have written this (although I am not sure
others would have agreed it was a good choice, we have seem quite a
bit of code that demands close packaing of 3-bit components (both
VADS and Alsys at least, supported this feature).

Yes, as Tuck says, if your primary concern is that code written for your
compiler be easy to move to other compilers, then you implement the
minimal lower bound. But if, as in the case of GNAT, your primary goal
is to be inclusive, and correctly process code from other existing
compilers providing a wide range of functionality that is permitted by
the RM, but not required, or recommended against, then you implement
the maximum.

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. VADS at least permitted this implicit packing (even though
there was an AI that recommended against it).

Consequently in GNAT, we reject the above, and require an explicit pragma
Pack. 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!





  parent reply	other threads:[~1997-09-01  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         ` David C. Hoos, Sr.
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-01  0:00                 ` Robert Dewar [this message]
1997-09-02  0:00                   ` Robert A Duff
1997-09-02  0:00                   ` Fergus Henderson
     [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-08-27  0:00           ` Robert Dewar
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-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