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/08/28
Date: 1997-08-28T00:00:00+00:00	[thread overview]
Message-ID: <dewar.872797072@merv> (raw)
In-Reply-To: jeffrey.m.creem-2808970708260001@ljd155.sanders.lockheed.com


Jeff said

<<do. Since most of my prior experience has been with
VADS I never took note of that LRM reference however I still am a fan of
the size clause being applied after the pragma pack since if the pack does
not pack the elements as tightly as you'd like the size clause gives the
compiler an oportunity to complain that it can not fit the structure into
the number of bits your have requested.>>

Indeed, the confirming size clause is definitely appropriate. In fact consider
the example that inspired the thread:

  type x is range 0 .. 7;
  for x'size use 3;

  type r is array (1 .. 8) of x;
  pragma Pack (r);
  for r'size use 24;

The size clause says here, I *really* want tight packing, the RM allowed
expansion to 4 bits is not acceptable.

Now your code will be accpted by GNAT that is doing what you want, but
rejected by a compiler taking advantage of the RM's permissiveness here.

Of course this rejection may mean you have a problem on your hands, but
at least you know right away at compile time.





  parent reply	other threads:[~1997-08-28  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           ` 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
     [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-27  0:00         ` Robert Dewar
     [not found]           ` <jeffrey.m.creem-2808970708260001@ljd155.sanders.lockheed.com>
1997-08-28  0:00             ` Robert Dewar [this message]
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