comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Converting a C/C++ statement to Ada
Date: Mon, 11 Feb 2013 10:53:36 -0800 (PST)
Date: 2013-02-11T10:53:36-08:00	[thread overview]
Message-ID: <eff6a8c1-f589-46b1-9a4e-d4d9a17d9e16@googlegroups.com> (raw)
In-Reply-To: <lywquercwe.fsf@pushface.org>

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-11 18: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 [this message]
2013-02-12  8:53     ` ldries46
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