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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: System.Address to Access to function/procedure conversion Date: Sun, 28 Jul 2013 10:19:18 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 28 Jul 2013 17:12:55 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="68bb7ebc916066bb85146425b2aa8565"; logging-data="13017"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UWkkRvlXirmdPAFsLV1dEFY2SL2Ng37o=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Cancel-Lock: sha1:1px3zpujaSPX4bQzvQkPtj0NdCM= Xref: news.eternal-september.org comp.lang.ada:16579 Date: 2013-07-28T10:19:18-07:00 List-Id: On 07/28/2013 08:27 AM, Tarek Ghaleb wrote: > > As for why not just pass an Access to the function directly, the > Address is actually passed to a C function which later passes it back > to Ada. If you want any semblance of portability, then you should never pass an Address to C. You should only pass a C-convention access type. The value must be stored as a pointer on the C side, and there is no guarantee that Ada's Address has any relationship to a C pointer. A C-convention access type, on the other hand, is guaranteed to make sense as a C pointer. -- Jeff Carter "Oh Lord, bless this thy hand grenade, that with it thou mayst blow thine enemies to tiny bits, in thy mercy." Monty Python and the Holy Grail 24