comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: simple question - how to emulate void * ?
Date: 1998/10/23
Date: 1998-10-23T00:00:00+00:00	[thread overview]
Message-ID: <362fff27.42726442@SantaClara01.news.InterNex.Net> (raw)
In-Reply-To: 9v6hGdgMLuwN-pn2-Oc41W71Dq3U9@dt182n2f.tampabay.rr.com

You might look into Ada.Streams.  Alternatively, if you really want to
send the bytes comprising the data (which would make little sense if
they were pointers, say), you can either create an array of bytes,
located at the same address as the data, or simply do an unchecked
conversion from the data to an array of bytes of the appropriate size.
 type bytes is mod 256;
  for bytes'size use 8;
type byte_array_type is array(natural range <>) of bytes;
procedure send_bytes(b : in byte_array_type) is .....
procedure send(x : in some_record_type) is
  subtype x_byte_array_type is byte_array_type(1 .. x'size/8);
  for x_byte_array_type'size use x'size;
  function bytes_of is new
Ada.Unchecked_Conversion(source=>some_record_type;
     target=>x_byte_array_type);
begin
    send_bytes(bytes_of(x));
end send;
  (Typed in on the fly, but should give the general idea)




  parent reply	other threads:[~1998-10-23  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-23  0:00 simple question - how to emulate void * ? Craig Allen
1998-10-23  0:00 ` Dale Stanbrough
1998-10-22  0:00   ` Hans Marqvardsen
1998-10-23  0:00     ` John McCabe
1998-10-23  0:00       ` Ed Falis
1998-10-23  0:00         ` dennison
1998-10-24  0:00           ` Joe Wisniewski
1998-10-25  0:00           ` dewar
1998-10-24  0:00         ` Dale Stanbrough
1998-10-24  0:00           ` Tucker Taft
1998-10-24  0:00           ` Robert A Duff
1998-10-23  0:00       ` dennison
1998-10-22  0:00   ` Hans Marqvardsen
1998-10-23  0:00   ` David C. Hoos, Sr.
1998-10-23  0:00   ` David C. Hoos, Sr.
1998-10-23  0:00 ` Tom Moran [this message]
1998-10-23  0:00 ` Jeff Carter
1998-10-24  0:00   ` Dale Stanbrough
1998-10-25  0:00     ` dewar
1998-11-05  0:00 ` Craig Allen
1998-11-06  0:00   ` Dale Stanbrough
1998-11-06  0:00     ` Matthew Heaney
1998-11-06  0:00       ` dewarr
1998-11-06  0:00   ` Tom Moran
replies disabled

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