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,e977cd3ab4e49fef X-Google-Attributes: gid103376,public From: Jerome Desquilbet Subject: Re: Question about record rep spec placement Date: 1997/01/16 Message-ID: <32DE48C3.446B@Rational.COM>#1/1 X-Deja-AN: 210201328 references: <32DCFDAA.2656@lmtas.lmco.com> to: Ken Garlington content-type: text/plain; charset=us-ascii organization: Rational Software Corporation in (the) SQY, France mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (X11; I; OSF1 V3.2 alpha) Date: 1997-01-16T00:00:00+00:00 List-Id: Ken Garlington wrote: > > We have some Ada83 code that looks like the following: > > package Some_Package is > > type Some_Record is record > -- components here > end record; > > -- some arbitrary declarations here > > private > > for Some_Record use record > -- component rep spec here > end record; > > end; > [...] > when this code was compiled with an Ada 95 compiler, that the record > rep spec had to be moved to immediately after the record declaration > for the code to compile correctly. This kind of contruction is legal in Ada 83 and in Ada 95. And I think this is really good style: you may want to hide in a private part the implementation details. The following example compiles with my Ada 83 and Ada 95 compilers: with System; package Communication is type Date is range 0 .. 3600; type Word is range -(2 ** 31) .. (2 ** 31) - 1; type Message is record Send_Date : Date; Content : Word; end record; private for Date'Size use 16; for Word'Size use 32; for Message use record Send_Date at 0 range 0 .. Date'Size - 1; Content at (Date'Size / System.Storage_Unit) range 0 .. Word'Size - 1; end record; for Message'Size use Date'Size + Word'Size; end Communication; You are able to document this as: with System; package Communication is type Date is range 0 .. 3600; type Word is range -(2 ** 31) .. (2 ** 31) - 1; type Message is record Send_Date : Date; Content : Word; end record; private ... end Communication; ______________________________________________________________________ Jerome Desquilbet jDesquilbet@Rational.COM ' ^