comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: ruw@ffi.no (Rune Wemberg)
Subject: Re: Interfacing Ada to C
Date: 1997/05/29
Date: 1997-05-29T00:00:00+00:00	[thread overview]
Message-ID: <m3afle72cl.fsf@zaphod.enst.fr> (raw)
In-Reply-To: 5mjvk9$sm7$1@luna.ffi.no


>>>>> "Rune" == Rune Wemberg <ruw@ffi.no> writes:

Rune> Does anyone know what a packed Ada record is?

It's a record on which you apply a pragma Pack. For example, the
following type R is a packed record:

  type My_Natural is range 0 .. 15;
  for My_Natural'Size use 4;

  type R is record
    A, B : My_Natural;
  end record;
  pragma Pack (R);
  for R'Size use 8;

If you do:

  My_R : aliased constant R := (1, 2);

then My_R will be represented in memory by a single byte containing
00010010 (or 00100001, depending on the endianness).

Here is the code generated by GNAT for the m68k:

.data
_t__my_r:
        .byte 0x12

Hope this helps.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




  parent reply	other threads:[~1997-05-29  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-29  0:00 Interfacing Ada to C Rune Wemberg
1997-05-29  0:00 ` Robert Dewar
1997-05-29  0:00 ` Samuel Tardieu [this message]
1997-05-30  0:00   ` Robert A Duff
1997-05-30  0:00   ` Matthew Heaney
1997-05-31  0:00     ` Robert A Duff
1997-06-07  0:00       ` Robert Dewar
1997-05-30  0:00 ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1999-06-14  0:00 Drew
1999-06-14  0:00 ` Steve Quinlan
1999-06-14  0:00 Drew
replies disabled

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