comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent Hoefler <ada.rocks@jlfencey.com>
Subject: Re: Limited_Controlled types as 'out' arguments
Date: Wed, 30 Jul 2003 17:01:54 +0200
Date: 2003-07-30T17:01:54+02:00	[thread overview]
Message-ID: <bg8mp8$lu8sc$1@ID-175126.news.uni-berlin.de> (raw)
In-Reply-To: slrnbiflb5.o6.lutz@taranis.iks-jena.de

Lutz Donnerhacke wrote:

>* Dmitry A Kazakov wrote:
>
[reading "out"-Parameters]
>> You can in Ada 95.
>
>Oops. Why?

Convinience. Sometimes it avoids the temporary copy that would be
needed in Ada83. See the example below.

>This is a clear data flow error,

Not if you have updated the object inside the procedure before reading
it, consider this:

|   procedure Set_Timer_Limits (Input_Frequency : in Frequency;
|                               Limit           : in Min_Max;
|                               Timer           : out TxParm;
|                               In_Range        : out Boolean) is
|   begin
|      --  here the Timer object is not yet initialized, reading
|      --  would be a data flow error
|      Timer.Min := Clamp8254 (Input_Frequency / Limit.Max);
|      Timer.Max := Clamp8254 (Input_Frequency / Limit.Min);
|
|      --  but here we can simply read it without data flow error
|      --  or the need for a temporary copy
|      In_Range := ((Input_Frequency / Timer.Max) > Limit.Min) and
|                  ((Input_Frequency / Timer.Min) < Limit.Max);
|   end Set_Timer_Limits;


Vinzent.



  parent reply	other threads:[~2003-07-30 15:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-30 11:31 Limited_Controlled types as 'out' arguments Lutz Donnerhacke
2003-07-30 12:22 ` Dmitry A. Kazakov
2003-07-30 12:32   ` Lutz Donnerhacke
2003-07-30 14:24     ` Dmitry A. Kazakov
2003-07-30 14:25       ` Lutz Donnerhacke
2003-07-30 14:48         ` Dmitry A. Kazakov
2003-07-30 15:15           ` Lutz Donnerhacke
2003-07-31 10:26             ` Dmitry A. Kazakov
2003-07-31 10:54               ` Lutz Donnerhacke
2003-07-31 11:50                 ` Dmitry A. Kazakov
2003-07-31 12:19                   ` Lutz Donnerhacke
2003-07-31 13:15                     ` Dmitry A. Kazakov
2003-07-31 17:51                 ` Randy Brukardt
2003-07-30 15:01         ` Vinzent Hoefler [this message]
2003-07-30 15:16           ` Lutz Donnerhacke
2003-07-30 15:52         ` Lutz Donnerhacke
2003-07-30 19:30           ` Randy Brukardt
2003-07-31  7:43             ` Lutz Donnerhacke
2003-07-30 12:31 ` Matthew Heaney
2003-07-30 12:57   ` Lutz Donnerhacke
2003-07-30 13:47     ` Martin Dowie
2003-07-30 17:06     ` Matthew Heaney
2003-07-30 12:37 ` Martin Dowie
2003-07-30 12:59   ` Lutz Donnerhacke
2003-07-30 13:41     ` Martin Dowie
replies disabled

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