From: "John P. Lippiello" <lippiell@ma.aonix.com>
Subject: Re: Boolean array representation question
Date: 1997/11/21
Date: 1997-11-21T00:00:00+00:00 [thread overview]
Message-ID: <EK033F.9ps@sd.aonix.com> (raw)
In-Reply-To: 880041511.80snx@jvdsys.nextjk.stuyts.nl
The size 40 is to be expected since you have an array of 5 booleans and each
boolean takes 8 bits. In order to get the size down to 8 bits, try the
following line:
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_1 is
type Bit_Array is array (Natural range <>) of Boolean;
pragma pack(Bit_Array); -- ADD THIS LINE
My_Array : Bit_Array (0 .. 4) := (others => False);
begin
Put_Line ("The size of Bit_Array is" &
Integer'Image (My_Array'Size));
end Test_1;
Jerry van Dijk wrote in message <880041511.80snx@jvdsys.nextjk.stuyts.nl>...
>When compiling the following program:
>
> with Ada.Text_IO; use Ada.Text_IO;
>
> procedure Test_1 is
> type Bit_Array is array (Natural range <>) of Boolean;
> My_Array : Bit_Array (0 .. 4) := (others => False);
> begin
> Put_Line ("The size of Bit_Array is" &
> Integer'Image (My_Array'Size));
> end Test_1;
>
>both GNAT and OA on NT report the size as 40 so I wonder if
>this is some kind of magic number and where it is coming from.
>Thanks,
>Jerry.
>
>--
>
>-- Jerry van Dijk | Leiden, Holland
>-- Consultant | Team Ada
>-- Ordina Finance | jdijk@acm.org
next prev parent reply other threads:[~1997-11-21 0:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-20 0:00 Boolean array representation question Jerry van Dijk
1997-11-20 0:00 ` Matthew Heaney
1997-11-21 0:00 ` John P. Lippiello [this message]
1997-11-22 0:00 ` Jerry van Dijk
1997-11-22 0:00 ` Robert Dewar
1997-11-22 0:00 ` Matthew Heaney
1997-11-22 0:00 ` Robert Dewar
1997-11-23 0:00 ` Geert Bosch
1997-11-24 0:00 ` Larry Kilgallen
1997-11-24 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox