comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Size of a pointer to a tagged record
Date: Wed, 04 Dec 2002 17:05:57 GMT
Date: 2002-12-04T17:05:57+00:00	[thread overview]
Message-ID: <3DEE3622.904@acm.org> (raw)
In-Reply-To: asl1ri$l1t$1@pegasus.csx.cam.ac.uk

Steven Murdoch wrote:
> I am writing a binding to the Lua (http://www.lua.org/)
> scripting language (which is written in C). One thing I
> need to do is store a pointer to a tagged record in a
> memory location allocated by malloc. For this reason I need
> to know the size.

If you declare your access type as having Convention C, then it will be 
the same size as a C pointer, and your C stuff can safely use the size 
of a C pointer.

If you tell the C side what size to use, then why not simply calculate 
the size to pass to C? You can use 
Type_Name'Max_Size_In_Storage_Elements, or {Object_Name'Size + 
Storage_Unit - 1) / Storage_Unit.

-- 
Jeff Carter
"Go and boil your bottoms."
Monty Python & the Holy Grail




      parent reply	other threads:[~2002-12-04 17:05 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
2002-12-04 20:27       ` Simon Wright
2002-12-04 18:11     ` tmoran
2002-12-04 17:05 ` Jeffrey Carter [this message]
replies disabled

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