comp.lang.ada
 help / color / mirror / Atom feed
* Puzzling question
@ 1997-05-08  0:00 Chris Sparks (Mr. Ada)
  1997-05-08  0:00 ` Adam Beneschan
  1997-05-10  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Sparks (Mr. Ada) @ 1997-05-08  0:00 UTC (permalink / raw)



Hi all,

I have the following files:

----------------------------------------------------------------------
package T is

  type Rec_Type is record
    A : Integer;
    B : Integer;
  end record;

  procedure S (U : out Rec_Type);

end T;
----------------------------------------------------------------------
with System;

package body T is

  procedure R (V : in System.Address) is begin

    null;

  end R;

  procedure S (U : out Rec_Type) is begin

    U.A := 1;
    U.B := 2;

    R (V => U.A'Address);  -- Why is this valid????????????????

  end S;

end T;
----------------------------------------------------------------------
with T; use T;

procedure T1 is

  M : Rec_Type;

begin
  T.S (U => M);
end;
----------------------------------------------------------------------

At work we are using Ada 83 and I thought that if a parameter is "out"
in a procedure then only assignments could be made to the variable.
In the call to R above, U.A would effectively be considered an input
which I thought would be illegal since U is an "out" type.  I know that
in Ada 95 this is ok, however, I don't know why this works under Ada 83.

Any help will be appreciated.

Chris Sparks




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-05-10  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-05-08  0:00 Puzzling question Chris Sparks (Mr. Ada)
1997-05-08  0:00 ` Adam Beneschan
1997-05-10  0:00 ` Robert Dewar

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