comp.lang.ada
 help / color / mirror / Atom feed
From: <wemagor@sym1cca.rockwell.nospam (Wayne Magor)
Subject: Redefining Integer
Date: 1997/11/08
Date: 1997-11-08T00:00:00+00:00	[thread overview]
Message-ID: <640di0$l432@castor.cca.rockwell.com> (raw)



I am porting some old code that assumes Integer is 16-bits and does lots
of unchecked conversions based on this fact.

When "Integer" is redefined in the same declarative region that it is
used it works fine:

  type Integer is range -2**15 .. 2**15 - 1;
  for Integer'Size use 16;

  subtype bit_range is integer range 0 .. integer'size - 1;
  type packed_boolean_array is array (Bit_Range) of Boolean;
  for packed_boolean_array'Size use 16;
  pragma Pack (packed_boolean_array);

however, if I put this declaration of Integer into a separate package and
put a "with" and "use" on every package that uses Integer, it doesn't work.
I get this type of message:

    7       for packed_boolean_array'Size use 16;
...........1
%ADAC-E-SIZE_NOT_EXACT, (1) The number of bits to represent index constraint
        {type for packed_boolean_array} at line 6 must be exactly 32 [LRM
        13.2(6+), 13.4(5+)]

This tells me that the compiler is using 32 for the value of Integer'Size.
Why is that?  Are the declarations in Standard visible before the use
clause declarations?




             reply	other threads:[~1997-11-08  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-08  0:00 Wayne Magor [this message]
1997-11-08  0:00 ` Redefining Integer Wayne Magor
1997-11-16  0:00 ` Matthew Heaney
replies disabled

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