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-06 22:55:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: Subject: Re: Size of a pointer to a tagged record X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <2YgI9.47166$hK4.4138828@bgtnsc05-news.ops.worldnet.att.net> Date: Sat, 07 Dec 2002 06:55:58 GMT NNTP-Posting-Host: 12.89.135.100 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1039244158 12.89.135.100 (Sat, 07 Dec 2002 06:55:58 GMT) NNTP-Posting-Date: Sat, 07 Dec 2002 06:55:58 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:31521 Date: 2002-12-07T06:55:58+00:00 List-Id: Steven Murdoch wrote : > In article , > Robert A Duff 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 . 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