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: mheaney@ni.net (Matthew Heaney) Subject: Re: Boolean array representation question Date: 1997/11/22 Message-ID: #1/1 X-Deja-AN: 291510291 References: <880170219.81snx@jvdsys.nextjk.stuyts.nl> Distribution: world Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-11-22T00:00:00+00:00 List-Id: In article <880170219.81snx@jvdsys.nextjk.stuyts.nl>, jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) wrote: >In article lippiell@ma.aonix.com writes: > >> pragma pack(Bit_Array); -- ADD THIS LINE > >Yes, I know. > >The point is for some reason I have Boolean'Size = 1 in my >head and cannot find the Boolean'Size =8^HStorage_Unit, other >implicitly in 3.5.3. You've got it right; Boolean'Size is defined to be 1. However, you're really interested in the component size of the array object. The only requirement is that the size of the array component can't be less than the size of the component type. If your compiler optimizes for speed, it's going to use the most time-efficient way to get the value of a component. For a Boolean, it makes the most sense to allocate some integral number of storage elements for each component. It could be 8, 16, 32, whatever. The value 8 seems to be the best compromise between time and space. To pack the components in contiguous bits by default would mean that it takes a lot longer to access each component (on an architecture in which each bit isn't independently addressable). -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271