From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eb420f872d7f3049 X-Google-Attributes: gid103376,public From: "John P. Lippiello" Subject: Re: Boolean array representation question Date: 1997/11/21 Message-ID: #1/1 X-Deja-AN: 291238033 Sender: news@sd.aonix.com (USENET News Admin @flash) X-Nntp-Posting-Host: 192.157.137.45 References: <880041511.80snx@jvdsys.nextjk.stuyts.nl> X-Mimeole: Produced By Microsoft MimeOLE V4.71.1712.0 Organization: Aonix Newsgroups: comp.lang.ada Date: 1997-11-21T00:00:00+00:00 List-Id: 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