From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 29 Sep 92 17:07:54 GMT From: wdl39!mab@ford-wdl1.arpa (Mark A Biggar) Subject: Re: Declaring Arrays of Bits (how)? Message-ID: <1992Sep29.170754.4140@wdl.loral.com> List-Id: In article young@gdfwc3 (Mark Young) writes : >I am trying to declare arrays of bits in Ada. Here's my attempt: >type Array_Range_Type is range 1..128; >type Bit_Type is (OFF, ON); >for Bit_Type use (OFF => 0, ON => 1); >for Bit_Type'size use 1; >type Bit_Array_Type is array (Array_Range_Type) of Bit_Type; >Bit_Array : Bit_Array_Type; > >This looks right to me. I would expect Bit_Array to be represented >as an array of 128 bits (128 contiguous bits). This is not the case, >however. My compiler (XDADA) is representing Bit_Array as an array >of 128 bytes. As an added note, I have been using representation clauses >for records without any problems. >Am I missing something? >Is there a special representation clause for arrays that I am overlooking? >Is my compiler at fault? For most compilers you probably need to throw a: pragma PACKED(Bit_Array_Type); in the mix somewhere as well. Otherwise according to the LRM the compiler is under no obligation to put the array element in anything smaller then a byte each unless you add the pragma PACKED. -- Mark Biggar mab@wdl1.wdl.loral.com