comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent Guerby <guerby@acm.org>
Subject: Re: Access and alias
Date: 2000/04/04
Date: 2000-04-04T18:52:49+00:00	[thread overview]
Message-ID: <86d7o5ae23.fsf@ppp-169-201.villette.club-internet.fr> (raw)
In-Reply-To: vEpG4.1568$sB3.971@news.indigo.ie

"NANCY HEHIR" <nanceh.ennis@tinet.ie> writes:
> I don't understand my compile error and am having trouble finding help in
> GNAT or Annotated Reference Manual.
> 
> Can anyone explain what's going wrong here, please ?
> I am trying to assign an initial address to an access variable.....
> 
> type LPDCB is access all DCB;
> .
> .
> DCB_1:DCB;

Try:

 DCB_1 : aliased DCB;

> .
> .
> DCB_Access:LPDCB := DCB'Access;
> 
> compiler generates error 'prefix of "Access" attribute must be aliased'

However, it is very "rare" in Ada to use aliased variables, if you're
from a C background and try to write Ada like you write C I think
adding "aliased" and "'access" everywhere is not the right thing to
do. A possible guess is that you are emulating the use of "&" in C
with aliased/access, and that the right way to do it in Ada is to use
the "in out" parameter mode.

May be if you tell us more about what you're trying to do, we can
suggest appropriate Ada idioms (note that may be the use of aliased
and access is the appropriate idiom here ;-).

--LG




  reply	other threads:[~2000-04-04  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-04  0:00 Access and alias NANCY HEHIR
2000-04-04  0:00 ` Laurent Guerby [this message]
2000-04-04  0:00   ` NANCY HEHIR
2000-04-04  0:00     ` Laurent Guerby
2000-04-05  0:00       ` Alfred Hilscher
2000-04-05  0:00         ` Ted Dennison
2000-04-05  0:00           ` Jeff Carter
2000-04-06  0:00             ` Alfred Hilscher
2000-04-07  0:00               ` Jeff Carter
2000-04-06  0:00             ` Robert Dewar
2000-04-07  0:00               ` Jeff Carter
2000-04-06  0:00           ` tmoran
2000-04-07  0:00             ` Robert Dewar
2000-04-07  0:00               ` tmoran
2000-04-09  0:00                 ` Robert Dewar
2000-04-09  0:00                   ` tmoran
2000-04-10  0:00                 ` Jack W. Sharer
2000-04-06  0:00           ` Robert Dewar
2000-04-05  0:00         ` Laurent Guerby
2000-04-05  0:00     ` Jeffrey D. Cherry
2000-04-04  0:00 ` tmoran
replies disabled

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