comp.lang.ada
 help / color / mirror / Atom feed
* in-out and out parameters
@ 2004-02-26 14:00 Evangelista Sami
  2004-02-26 14:18 ` Frank J. Lhota
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Evangelista Sami @ 2004-02-26 14:00 UTC (permalink / raw)


hello

i have this program :
====================
procedure Test is

   task T is
      entry E(I :    out Integer;
              J : in out Integer);
   end T;
   task body T is
   begin
      accept E(I :    out Integer;
               J : in out Integer) do
         I := 1;
         J := J * I;
         J := J * J;
      end E;
   end;

   I : Integer := 10;

begin
   T.E(I, I);
   Put_Line(Integer'Image(I));
end;
====================
The output is 1.
I thought that, as I and J were passed by references, when i call E
with the
same variables, I and J denote the same object. so i was expecting to
get 100 in output.
If someone had a clear explanation i would be very thankful.



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

end of thread, other threads:[~2004-02-27 23:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-26 14:00 in-out and out parameters Evangelista Sami
2004-02-26 14:18 ` Frank J. Lhota
2004-02-26 14:23 ` Jacob Sparre Andersen
2004-02-26 14:29 ` Jean-Pierre Rosen
2004-02-26 14:30 ` Hyman Rosen
2004-02-27 23:54   ` Randy Brukardt

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