From: Jeffrey Carter <spam@spam.com>
Subject: Re: Interfacing with C: access/out parameters
Date: Mon, 30 Aug 2004 19:06:34 GMT
Date: 2004-08-30T19:06:34+00:00 [thread overview]
Message-ID: <_UKYc.2897$w%6.1362@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <2ph6fjFkpsahU1@uni-berlin.de>
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
next prev parent reply other threads:[~2004-08-30 19:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-30 17:30 Interfacing with C: access/out parameters Jano
2004-08-30 19:06 ` Jeffrey Carter [this message]
2004-08-31 9:41 ` Alex R. Mosteo
2004-08-31 9:48 ` Alex R. Mosteo
2004-08-31 18:26 ` Jeffrey Carter
2004-09-01 9:46 ` Alex R. Mosteo
2004-08-31 7:54 ` Egil H. H�vik
2004-08-31 9:11 ` Egil H. H�vik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox