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,af7d617cad40d0b X-Google-Attributes: gid103376,public From: aaro@iki.fi (Aaro Koskinen) Subject: Re: Problem with representation clause Date: 1997/12/10 Message-ID: #1/1 X-Deja-AN: 296950059 References: <66gvas$pmp@remus.rutgers.edu> Organization: University of Helsinki Newsgroups: comp.lang.ada Date: 1997-12-10T00:00:00+00:00 List-Id: castroto@remus.rutgers.edu (Fabrizio Castrotorres) writes: > type Measurement_Status_Value is range -2 .. 1; > for Measurement_Status_Value'Size use 2; > > type Slot_Number is range 0 .. 23; > > type Integrity_Data is array (Slot_Number) of Measurement_Status_Value; > For Integrity_Data'Size use 24*2; -- REPRESENTATION 1 > pragma Pack(Integrity_Data); > > type Global_Integrity_Array is array( Slot_Number ) of Integrity_Data; > For Global_Integrity_Array'Size use 24*48; -- REPRESENTATION 2 > pragma Pack(Global_Integrity_Array); > The GNAT ADA 95 compiler (the one with the graphical user interface > for NT/95) lets th file compile fine. The problem comes when I try > to build the main module which uses this package specification (no > body). It gives me the following error message: > > size for "Global_Integrity_Array" too small, minimun allowed is 1536 The suggestion to specify a two-dimensional array is probably the nicest solution. However, I have found another solution, or more like a hack/kludge, which works with GNAT (3.10p): type Wrapper is record ID : Integrity_Data; end record; for Wrapper use record ID at 0 range 0 .. 47; end record; for Wrapper'size use 48; type Global_Integrity_Array is array( Slot_Number ) of Wrapper; For Global_Integrity_Array'Size use 24*48; -- REPRESENTATION 2 pragma Pack(Global_Integrity_Array); This results in a 1152-bit array. I think this would be the only way to it, if Integrity_Data were not an array... -- Aaro Koskinen (aaro@iki.fi) http://www.iki.fi/aaro/