comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Forwarding declaration?
Date: Fri, 1 Apr 2005 11:03:57 +0200
Date: 2005-04-01T11:03:52+02:00	[thread overview]
Message-ID: <12n3iagr7ygz6.fa1zf1uu12bf.dlg@40tude.net> (raw)
In-Reply-To: 1112344582.787855.248880@o13g2000cwo.googlegroups.com

On 1 Apr 2005 00:36:22 -0800, Andrew wrote:

> I have need of a forwarding declaration.  How do I do that in Ada?
> 
> --- example1 ---
> type Boob is record
>     Avar : A_Ptr;
> end record;
> type Boob_Ptr is access all Boob;
> 
> task type A(booby: Boob_Ptr) is
>    . . .
> end A;
> type A_Ptr is access all A;
> ------------------
> 
> compiler says (and I say) that A_Ptr is undefined for Boob.
> 
> Now if I could use a temporary placeholder for A_Ptr (a forwarding
> declaration) then the compiler and I would be happy.
> 
> --- example2 ---
> -- forwarding declaration
> temporary declaration of A_Ptr;
> 
> type Boob is record
>     Avar : A_Ptr;
> end record;
> type Boob_Ptr is access all Boob;
> 
> task type A(booby: Boob_Ptr) is
>    . . .
> end A;
> type A_Ptr is access all A;
> ------------------

type A; -- Forward declaration of A
type A_Ptr is access all A;

type Boob is record
  Avar : A_Ptr;
end record;
type Boob_Ptr is access all Boob;

task type A (booby : access Boob) is -- No need in pointers here
   ...
end A;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-04-01  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01  8:36 Forwarding declaration? Andrew
2005-04-01  9:03 ` Dmitry A. Kazakov [this message]
2005-04-01  9:22   ` Andrew
replies disabled

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