* access types and head pains
@ 2001-05-25 23:59 chris.danx
2001-05-26 4:39 ` Jeffrey Carter
0 siblings, 1 reply; 5+ messages in thread
From: chris.danx @ 2001-05-25 23:59 UTC (permalink / raw)
hi,
I have the following situation. I'm writing a driver that can be run on my
system. I want to test it by writing virtually to a file.
The problem is i had the following code
package X is
type A is private
type A_ac is access all A;
...
procedure Do_S (av : in out A_ac; v : any_type );
-- with body
-- is begin
-- av.v := v; etc
end X;
procedure test is
at : aliased A;
begin
Do_S (at'unchecked_access, 2);
end test;
i got an error that said "at actual must be a variable". What's wrong?
The idea is that the driver will work with two different kinda things in the
same procedure. "at" can be declared in program or be a chunk of memory of the
same size. Any hints?
Thanks,
Chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: access types and head pains
2001-05-25 23:59 access types and head pains chris.danx
@ 2001-05-26 4:39 ` Jeffrey Carter
2001-05-26 16:48 ` chris.danx
0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Carter @ 2001-05-26 4:39 UTC (permalink / raw)
"chris.danx" wrote:
>
> package X is
>
> type A is private
> type A_ac is access all A;
> ...
>
> procedure Do_S (av : in out A_ac; v : any_type );
>
> -- with body
> -- is begin
> -- av.v := v; etc
>
> end X;
>
> procedure test is
> at : aliased A;
> begin
> Do_S (at'unchecked_access, 2);
> end test;
>
> i got an error that said "at actual must be a variable". What's wrong?
>
> The idea is that the driver will work with two different kinda things in the
> same procedure. "at" can be declared in program or be a chunk of memory of the
> same size. Any hints?
I suspect your message read "av actual ...". The parameter av is mode in
out, which means Do_S may modify it. You can't change
at'unchecked_access, because then it wouldn't be at'unchecked_access any
more. Unless you have "av := ...;" in Do_S, why not just make it mode
in?
--
Jeff Carter
"I waggle my private parts at your aunties."
Monty Python & the Holy Grail
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: access types and head pains
2001-05-26 4:39 ` Jeffrey Carter
@ 2001-05-26 16:48 ` chris.danx
2001-05-26 17:17 ` Jeffrey Carter
0 siblings, 1 reply; 5+ messages in thread
From: chris.danx @ 2001-05-26 16:48 UTC (permalink / raw)
> I suspect your message read "av actual ...". The parameter av is mode in
> out, which means Do_S may modify it. You can't change
> at'unchecked_access, because then it wouldn't be at'unchecked_access any
> more. Unless you have "av := ...;" in Do_S, why not just make it mode
> in?
I'll try that. I'm a little confused though.
(let's change the name "at" to al_t, i quickly wrote down the example with short
identifiers of which at happened to appear, i know it's a reserved word! i was
tired)
a_ac is a general access type
if av has mode "in" then how can i modify the fields of the record. surely this
would be dissallowed or does it mean you can't modify it's existance/null status
but can modify it's data?
Chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: access types and head pains
2001-05-26 16:48 ` chris.danx
@ 2001-05-26 17:17 ` Jeffrey Carter
2001-05-26 17:31 ` chris.danx
0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Carter @ 2001-05-26 17:17 UTC (permalink / raw)
"chris.danx" wrote:
>
> a_ac is a general access type
>
> if av has mode "in" then how can i modify the fields of the record. surely this
> would be dissallowed or does it mean you can't modify it's existance/null status
> but can modify it's data?
Given
Av : in A_Ac
you can't modify Av; within the subprogram Av is a constant. You can,
however, modify the value designated by Av (Av.all); since A_Ac is not
"access constant", Av.all is not a constant.
--
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-05-26 17:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25 23:59 access types and head pains chris.danx
2001-05-26 4:39 ` Jeffrey Carter
2001-05-26 16:48 ` chris.danx
2001-05-26 17:17 ` Jeffrey Carter
2001-05-26 17:31 ` chris.danx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox