"reinert" <
[email protected]> wrote in message news:
[email protected]...
I expected an "out" parameter in a procedure to be like declaring the >parameter "from scratch" (with actual initial default value). For my
compiler (GNAT Community Edition, May 2021) it seems like the
out parameters brings in content from the calling procedure. Should
it be like this?
It depends on the data type; there is a complex series of rules about what
is passed in for an out parameter. The basic idea is that stuff like bounds
and discriminants are passed in, while other things may or may not be passed in.
Probably it is best to think of the distinction between in out and out parameters as being for the programmer, as noted by Jean-Pierre. When you
say "out", you are asserting that you do not care what is passed in -- it
could be in any state or even uninitialized. When you say "in out", you
expect a value that you can use in the subprogram, so it has to meet the constraints and other requirements.
For instance, "out" parameters are checked as little as possible on the way
in, while an "in out" parameter has all of the checking one might expect. Of course, if you are working with a well-designed ADT (as in the case of the containers), the difference between an unchecked item and a fully checked
item is minimal. If you were working with an elementary type like an integer
or access type, the input value may not be initialized at all.
Hope this helps.
Randy.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)