comp.lang.ada
 help / color / mirror / Atom feed
From: "David Thompson" <david.thompson1@worldnet.att.net>
Subject: Re: Size of a pointer to a tagged record
Date: Sat, 07 Dec 2002 06:55:58 GMT
Date: 2002-12-07T06:55:58+00:00	[thread overview]
Message-ID: <2YgI9.47166$hK4.4138828@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: aslfjh$1vc$1@pegasus.csx.cam.ac.uk

Steven Murdoch <news01+Steven.Murdoch@cl.cam.ac.uk> wrote :
> In article <wccvg29d7q8.fsf@shell01.TheWorld.com>,
>  Robert A Duff <bobduff@shell01.TheWorld.com> writes:
...
> >One thing you might think about is taking 'Size on the Ada side,
> >converting that to bytes (using System.Storage_Unit), and passing
> >that to the C code at some point.  The C code might be able to
> >use that size, or else assert that it is correct.
>
> I will try that too, the size is set during run time so there
> should not be any problem setting it. IIRC Malloc takes a number of
> octets so I could use a variant of Jeff Carters suggestion such as
> (Parameter_Access'Size + 7) / 8
> This should be the right thing to pass in, even if Storage_Unit is not 8
>
C malloc et al measure size in bytes as defined by that
C implementation, which must be at least 8 bits but may
be more, for exactly the same reasons SSU may vary;
the value is provided by macro CHAR_BIT in <limits.h>.

Neither standard requires C CHAR_BIT to equal Ada SSU,
it would be out of scope;  but logically they should be the same,
and if your implementation doesn't do so I think you're out of luck.

--
- David.Thompson 1 now at worldnet.att.net






  parent reply	other threads:[~2002-12-07  6:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04 14:01 Size of a pointer to a tagged record Steven Murdoch
2002-12-04 15:16 ` Robert A Duff
2002-12-04 15:44   ` Steven Murdoch
2002-12-04 17:17     ` Robert A Duff
2002-12-04 17:56       ` Steven Murdoch
2002-12-04 19:10         ` Robert A Duff
2002-12-07  6:55         ` David Thompson [this message]
2002-12-04 20:27       ` Simon Wright
2002-12-04 18:11     ` tmoran
2002-12-04 17:05 ` Jeffrey Carter
replies disabled

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