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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a5aa52a6f866183 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-28 22:17:02 PST Path: nntp.gmd.de!xlink.net!fauern!zib-berlin.de!prise.nz.dlr.de!news.dfn.de!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Flags in Ada? Date: 27 Oct 1994 17:15:53 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <38on89$mo6@watnews1.watson.ibm.com> References: <38nces$bdv@news.delphi.com> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-10-27T17:15:53+00:00 List-Id: In article <38nces$bdv@news.delphi.com>, tmoran@bix.com (quoting Robert Dewar) writes: |> >As I noted in a previous message, pragma pack should work just fine on |> >records, it is NOT necessary to give record representation clauses unless |> >they are needed to match an external specification. In Ada 9X in particular, |> >one would assume that even in the latter case, the use of: |> > |> > pragma COnvention (C, rectype); |> |> >should be adequate to ensure a match up with the C type. In GNAT, convention |> >C is the default (i.e. for datatypes that match, convention Ada and |> >convention C are identical), so it works even in the absnece of this |> >pragma. |> |> Does 'C' specify how the bit fields are arranged? No. ANSI C states that there is an implementation-defined "allocation unit" (this is typically the size of a register that can be used in shift/rotate and masking instructions) and that bit fields are to be packed as tightly as possible into an allocation unit. However, the size of the allocation unit, the option of advancing to the start of the next allocation unit if there is not enough room to fit the next bit field in the current allocation unit, and the direction in which allocation units are filled with bit fields (MSB->LSB or LSB->MSB) is explicitly implementation-defined. (Only the last issue, the direction in which allocation units are filled, is relevant when all bit fields are one bit long.) The "language name" in the Convention pragma is really better understood as a "language processor name". When you ask a Gnu Ada compiler to use C conventions, you are asking it to use the conventions of the Gnu C compiler. (A compiler can provide different convention names for different C compilers, as long as the standard convention name "C" applies to one of them.) -- Norman H. Cohen ncohen@watson.ibm.com