comp.lang.ada
 help / color / mirror / Atom feed
From: "Chris Sparks (Mr. Ada)" <sparks@AISF.COM>
Subject: Puzzling question
Date: 1997/05/08
Date: 1997-05-08T00:00:00+00:00	[thread overview]
Message-ID: <337209D7.4D25@aisf.com> (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




             reply	other threads:[~1997-05-08  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-08  0:00 Chris Sparks (Mr. Ada) [this message]
1997-05-08  0:00 ` Puzzling question Adam Beneschan
1997-05-10  0:00 ` Robert Dewar
replies disabled

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