comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: Flags in Ada?
Date: 27 Oct 1994 17:15:53 GMT
Date: 1994-10-27T17:15:53+00:00	[thread overview]
Message-ID: <38on89$mo6@watnews1.watson.ibm.com> (raw)
In-Reply-To: 38nces$bdv@news.delphi.com

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



  parent reply	other threads:[~1994-10-27 17:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-27  5:05 Flags in Ada? tmoran
1994-10-27 13:29 ` Robert Dewar
1994-10-27 17:15 ` Norman H. Cohen [this message]
1994-10-28  3:51   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1994-10-28  3:59 tmoran
1994-10-28 13:43 ` Robert Dewar
1994-10-31 14:19   ` Norman H. Cohen
1994-11-02 14:06     ` Mats Weber
1994-11-03 23:08       ` Robert Dewar
1994-11-03 11:26     ` Robert Dewar
1994-10-27  5:06 tmoran
1994-10-27 13:47 ` Robert Dewar
1994-10-28  2:41   ` Tucker Taft
1994-10-30 13:31     ` Robert Dewar
1994-10-25 16:22 tmoran
1994-10-25 10:36 Andre Spiegel
1994-10-25 10:07 ` David Emery
1994-10-25 16:19 ` Norman H. Cohen
1994-10-26  3:19   ` tmoran
1994-10-26  9:59     ` David Emery
1994-10-26 22:32       ` Robert Dewar
1994-10-27 13:24         ` Norman H. Cohen
1994-10-27 15:15         ` John Volan
1994-10-31  9:29         ` David Emery
1994-10-27 22:34       ` Henry G. Baker
1994-10-26 14:33     ` Robert Dewar
1994-10-26 17:43     ` Norman H. Cohen
1994-10-26 15:54   ` Andre Spiegel
1994-10-26  0:36 ` Dale Stanbrough
1994-10-26 11:01   ` Robert Dewar
1994-10-27  8:23 ` Henri Altarac
1994-10-27 23:00   ` Robert Dewar
1994-10-31  9:32     ` David Emery
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox