From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c1efbfe18e91d24 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-04 09:05:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DEE3622.904@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Size of a pointer to a tagged record References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 04 Dec 2002 17:05:57 GMT NNTP-Posting-Host: 63.184.17.144 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1039021557 63.184.17.144 (Wed, 04 Dec 2002 09:05:57 PST) NNTP-Posting-Date: Wed, 04 Dec 2002 09:05:57 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:31430 Date: 2002-12-04T17:05:57+00:00 List-Id: 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