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,fd398ca223dbbfd6 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: 'Size (novice question) Date: 2000/02/22 Message-ID: #1/1 X-Deja-AN: 588369372 Distribution: world Content-Transfer-Encoding: 8bit References: <38ACA68D.CEA7E03F@interact.net.au> <87aekxlz33.fsf@deneb.cygnus.argh.org> Content-Type: text/plain; charset=ISO-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 2000-02-22T00:00:00+00:00 List-Id: * Florian Weimer wrote: > Put ("Boolean'Size (type): "); Put (Boolean'Size); New_Line; > Put ("Boolean'Size (variable): "); Put (X'Size); New_Line; > >Almost no compiler will print 1 twice because on most architectures, >access to individual bits is expensive in both time and space when >compared to word or even octet access. But the following code can not use compressed variables: with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Size_Difference is X1, X2 : Boolean; A1, A2 : array (1..8) of Boolean; pragma Pack (X2,A2); -- I know, that a named array subtype is packable. begin Put ("Boolean'Size (type): "); Put (Boolean'Size); New_Line; Put ("Boolean'Size (X1): "); Put (X1'Size); New_Line; Put ("Boolean'Size (X2): "); Put (X2'Size); New_Line; Put ("Boolean'Size (A1): "); Put (A1'Size); New_Line; Put ("Boolean'Size (A2): "); Put (A2'Size); New_Line; end;