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-Thread: 103376,fce935e9f3aa1da8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 MSIE X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interfacing with C: access/out parameters References: <2ph6fjFkpsahU1@uni-berlin.de> In-Reply-To: <2ph6fjFkpsahU1@uni-berlin.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <_UKYc.2897$w%6.1362@newsread1.news.pas.earthlink.net> Date: Mon, 30 Aug 2004 19:06:34 GMT NNTP-Posting-Host: 63.184.105.71 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1093892794 63.184.105.71 (Mon, 30 Aug 2004 12:06:34 PDT) NNTP-Posting-Date: Mon, 30 Aug 2004 12:06:34 PDT Xref: g2news1.google.com comp.lang.ada:3179 Date: 2004-08-30T19:06:34+00:00 List-Id: Jano wrote: > Helper : aliased Datum; > For Helper'Address use Datum'Address; > if Thin_Package.Blah (Helper'Access) = Error_Value then > raise My_Error; > end if; Assuming that you meant "Data" in the declaration of Helper, this is probably not a good way to do this. I would advise: procedure Blah (Datum : out Data) is Helper : aliased Data; begin -- Blah if Thin_Package.Blah (Helper'access) = Error_Value then raise My_Error; end if; Datum := Helper; end Blah; Before anyone starts complaining about the "inefficiency" of using a second variable and doing an assignment, I ask 1. What are the explicit timing requirements for this software? 2. Does it fail to meet these requirements? 3. If so, is eliminating this assignment the only way to meet the timing requirements? I have never encountered SW where these could all be answered "Yes". Probably you don't want your software to be using C-convention types for anything except the interface to C, so you'd want your thick binding to have an Ada-convention type for Datum, and assign the fields of Helper to it. Horrors! Multiple assignments! -- Jeff Carter "Now look, Col. Batguano, if that really is your name." Dr. Strangelove 31