comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <nholsti@icon.fi>
Subject: Re: Ada address of operator?
Date: 1999/02/09
Date: 1999-02-09T00:00:00+00:00	[thread overview]
Message-ID: <36C0A636.C7ED48DA@icon.fi> (raw)
In-Reply-To: 36C02FFC.458368B1@aston.ac.uk

Danny wrote:
  (snipped; question on C operator "&" = "address of" in Ada)

Use the 'Access attribute. Note the use of "all" in the declaration of
the access types, and "aliased" in the declaration of the variable
you are accessing. Example:

package Ptrs is

  type AType is record
     X : integer;
  end record;

  type AnotherType is record
     Y : integer;
  end record;

  type ATypePtr is access all AType;
  type AnotherTypePtr is access all AnotherType;
  type AnotherTypePtrPtr is access all AnotherTypePtr;
  --
  pAnotherType : aliased AnotherTypePtr;
  ppAnotherType : AnotherTypePtrPtr := pAnotherType'access;

end Ptrs;


But are you sure you need all those "Ptr"s? The standard Ada/C binding
from pragma Import (C...) supplies some *'s automatically; see
LRM B.3(63-84).

- Niklas

Working at but not speaking for Space Systems Finland Ltd




  reply	other threads:[~1999-02-09  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-09  0:00 Ada address of operator? Danny
1999-02-09  0:00 ` Niklas Holsti [this message]
1999-02-10  0:00 ` Nick Roberts
1999-02-12  0:00   ` Nick Roberts
1999-02-11  0:00 ` Matthew Heaney
replies disabled

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