comp.lang.ada
 help / color / mirror / Atom feed
* Redefining Integer
@ 1997-11-08  0:00 Wayne Magor
  1997-11-08  0:00 ` Wayne Magor
  1997-11-16  0:00 ` Matthew Heaney
  0 siblings, 2 replies; 3+ messages in thread
From: Wayne Magor @ 1997-11-08  0:00 UTC (permalink / 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?




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-11-16  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-08  0:00 Redefining Integer Wayne Magor
1997-11-08  0:00 ` Wayne Magor
1997-11-16  0:00 ` Matthew Heaney

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