* Newbie access type help
@ 2002-03-05 21:31 Mattimus
2002-03-06 0:46 ` Steven Deller
2002-03-06 1:25 ` tmoran
0 siblings, 2 replies; 3+ messages in thread
From: Mattimus @ 2002-03-05 21:31 UTC (permalink / raw)
Hi Gurus,
I just started using Ada and am having some troubles with access types.
I have posted my very simple code below hoping someonce can help me. The
problem I am having occurs when trying to use the 'Access attribute of an
object. The compiler I am using is Apex NT, the error I am given is "Saw ' ,
expected OPERATOR". Can someone please point out where I am going wrong?
Please keep in mind when viewing the code sample that Nav is a package
defined elsewhere.
Thanks a bunch,
Matt
package Dispnavinterface is
type Nav_Ptr is access all Nav;
type Navinterface is
record
Navobject : aliased Nav;
Pos_Func_Ptr : Displays.Int_Func_Ptr;
end record;
Atempnav : Nav_Ptr;
end Dispnavinterface
--procedures
procedure Initialize
(Aninterface : in out Navinterface; Anav : Nav);
procedure Initialize
(Aninterface : in out Navinterface; Anav : Nav) is
begin
Aninterface.Navobject := Anav;
Aninterface.Pos_Func_Ptr := Return_Position;
Atempnav := (Aninterface.Navobject)'Access; <<-- THIS GIVES AN
ERROR
end Initialize;
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Newbie access type help
2002-03-05 21:31 Newbie access type help Mattimus
@ 2002-03-06 0:46 ` Steven Deller
2002-03-06 1:25 ` tmoran
1 sibling, 0 replies; 3+ messages in thread
From: Steven Deller @ 2002-03-06 0:46 UTC (permalink / raw)
If you look at the syntax for an attribute reference you will see that
it is composed of:
prefix ' access
and prefix is ONLY a "name". So the following
(prefix)'access
is illegal syntax.
Regards,
Steve
> Aninterface.Pos_Func_Ptr := Return_Position;
> Atempnav := (Aninterface.Navobject)'Access; <<--
> THIS GIVES AN ERROR
> end Initialize;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Newbie access type help
2002-03-05 21:31 Newbie access type help Mattimus
2002-03-06 0:46 ` Steven Deller
@ 2002-03-06 1:25 ` tmoran
1 sibling, 0 replies; 3+ messages in thread
From: tmoran @ 2002-03-06 1:25 UTC (permalink / raw)
> Atempnav := (Aninterface.Navobject)'Access; <<-- THIS GIVES AN
Lose the parens.
> type Nav_Ptr is access all Nav;
> Please keep in mind when viewing the code sample that Nav is a package
This clearly cannot be true. A package is not a type.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-03-06 1:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-05 21:31 Newbie access type help Mattimus
2002-03-06 0:46 ` Steven Deller
2002-03-06 1:25 ` tmoran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox