comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Need help with DEC Ada
Date: 19 Jan 1995 19:38:48 GMT
Date: 1995-01-19T19:38:48+00:00	[thread overview]
Message-ID: <EACHUS.95Jan19143848@spectre.mitre.org> (raw)
In-Reply-To: pdennis@vnet.ibm.com's message of Tue, 17 Jan 1995 21:01:19 GMT


In article <19950117.160119.606@vnet.ibm.com> pdennis@vnet.ibm.com (Phil Dennis) writes:

  > While I'm at it, I also had to change line 5 of the source code
  > so that the upper bound of the range was integer_32'last, rather
  > than (2**31) - 1.  That is because the latter expression also
  > generated a warning about a CONSTRAINT_ERROR.

    Your new form is correct and protable.  The old version runs into
a particularly nasty effect of the Ada type model.  (The expression
works for the type declaration, because those bounds can be of any
integer type.  But here the bounds must be of the parent type,
therefore the expression is evaluated using integer_32 arithmetic.)

 >	 7 type raw_memory_t is array(natural_32) of bit;
 >  .......1
 >  Info: (1) CONSTRAINT_ERROR will be raised here [LRM 11
 >  1(5)]

    I count this as a bug, but I remember someone from DEC arguing
otherwise.  Storage_Error here would not be surprising, but I think
what DEC is doing is evaluating the bounds of an unpacked array.  When
they reach the pramga pack, it is too late to go back.  (On the other
hand, you might want to try a range 0..integer_32'last. That might
make the size calculation more successful.  The current range includes
an odd number of bits.)

 >	 8 pragma pack(raw_memory_t);
 >	 9 type raw_memory_ptr_t is access raw_memory_t;
 >  .......1
 >  Info: (1) CONSTRAINT_ERROR will be raised here [LRM 11
 >  1(5)]

    This is totally bogus!  It is perfectly legitimate to have an
access type where the collection can never be populated, and no object
of the type is ever created.  The access type need not point to a bit,
in this case it designates an array type, so there should be no magic
packing of pointers involved.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



      parent reply	other threads:[~1995-01-19 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-17 21:01 Need help with DEC Ada Phil Dennis
1995-01-18 18:23 ` Mats Weber
1995-01-20  5:22   ` Robert Dewar
1995-01-23 16:22     ` Mats Weber
1995-01-19 19:38 ` Robert I. Eachus [this message]
replies disabled

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