comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: Converting a C/C++ statement to Ada
Date: Tue, 12 Feb 2013 09:53:07 +0100
Date: 2013-02-12T09:53:07+01:00	[thread overview]
Message-ID: <511a0336$0$9247$703f8584@news.kpn.nl> (raw)
In-Reply-To: <eff6a8c1-f589-46b1-9a4e-d4d9a17d9e16@googlegroups.com>

I am happy with this answer, thanks

L. Dries

"Adam Beneschan"  schreef in bericht 
news:eff6a8c1-f589-46b1-9a4e-d4d9a17d9e16@googlegroups.com...

On Monday, February 11, 2013 9:14:25 AM UTC-8, Simon Wright wrote:
> "ldries46" writes:
>
> > Can anyone tell me the Ada equivalent for the following C/C++
> > statement
>
> > typedef void (*Apple) (Pair *two_side, pointer_type user_data,
> > Error_type *error);
>
> I think it's something like
>
>    type Apple is access procedure (two_side : access Pair;
>                                    user_data : ?;
>                                    error : access Error_type);
>
> but of course the parameters may well not need to be accesses.

Right.  Unless the C/C++ code actually does something with the pointer 
values themselves (such as copying two_side or error into some global 
pointer variable that gets used later), then they probably should not be 
accesses, but rather just "in Pair", "out Pair", or "in out Pair" (and 
similarly for Error_type) depending on whether the Pair or its components 
are read, written, or both.

                             -- Adam 




  reply	other threads:[~2013-02-12  8:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 16:48 Converting a C/C++ statement to Ada ldries46
2013-02-11 17:14 ` Simon Wright
2013-02-11 18:53   ` Adam Beneschan
2013-02-12  8:53     ` ldries46 [this message]
2013-02-11 21:49 ` Quentin Ochem
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox