comp.lang.ada
 help / color / mirror / Atom feed
From: tgi@tgi2.dev.netgem.com (Tristan Gingold)
Subject: Re: Variable length raw-byte data
Date: 13 Dec 2000 08:56:32 GMT
Date: 2000-12-13T08:56:32+00:00	[thread overview]
Message-ID: <slrn93eee0.9j1.tgi@tgi2.dev.netgem.com> (raw)
In-Reply-To: 916h4j$egt$1@nnrp1.deja.com

In article <916h4j$egt$1@nnrp1.deja.com>, Robert Dewar wrote:
>In article
><976563484.10868.0.nnrp-01.c1ed21d4@news.demon.co.uk>,
>  "Julian Morrison" <julian.morrison@virgin.net> wrote:
>> I'm trying to shim to a C library that returns some data as a
>length in
>> bytes and a pointer to the first byte. The length is not known
>at compile
>> time. Is there any way I can morph this into an array of mod
>2**8? I'm
>> using the latest Linux GNAT.
>
>
>
>The important thing is to NEVER use pointers to unconstrained
>arrays in such a case. this is asking for non-portable, peculiar
>behavior.
>
>A good type to use in this case is what we in GNAT-land call
>big arrays:
>
>   type byte is mod 2 ** 8;
>
>   type memory is array (natural) of byte;
>   type memptr is access memory;
>
>Now it is almost certainly safe to use address_to_access
>conversions to go between address and memptr.
AFAIR, address_to_access_conversions has only one generic parameter: the
Object.
So, you need to use the access type defined by the package.
Right or wrong ?

Related question: why it is so ? (why AAC doesn't have the same paramaters
as unchecked_conversion ?)

Tristan.



  reply	other threads:[~2000-12-13  8:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-11 19:38 Variable length raw-byte data Julian Morrison
2000-12-12  5:19 ` Jeff Carter
2000-12-13  0:50 ` Robert Dewar
2000-12-13  8:56   ` Tristan Gingold [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-12-12  3:30 Beard, Frank
2000-12-12  5:54 ` tmoran
2000-12-12 21:00 Beard, Frank
2000-12-13 15:48 ` David Botton
2000-12-13 15:51   ` Lutz Donnerhacke
2000-12-13 19:34     ` Robert Dewar
2000-12-14  8:54       ` Lutz Donnerhacke
2000-12-13 23:10   ` Jeff Carter
2000-12-12 21:11 Beard, Frank
2000-12-13  2:56 Beard, Frank
2000-12-13 15:52 ` Robert Dewar
2000-12-13 18:23   ` Larry Kilgallen
2000-12-13 19:26     ` Robert Dewar
2000-12-13 20:39 Beard, Frank
2000-12-14 13:30 ` Robert Dewar
replies disabled

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