From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,803df5f3f60558d5 X-Google-Attributes: gid103376,public From: gauthier@unilim.fr (Michel Gauthier) Subject: Re: Uninitialized "out" parameters Date: 1996/07/19 Message-ID: #1/1 X-Deja-AN: 168823830 references: <31EEACDA.64880EEB@sage.inel.gov> organization: Universite de Limoges newsgroups: comp.lang.ada Date: 1996-07-19T00:00:00+00:00 List-Id: In article <31EEACDA.64880EEB@sage.inel.gov>, Paul Whittington wrote: >> In the following Ada program, should either the compiler or the run-time >> get some kind of error because the out parameter is not initialized? >> procedure Testit is >> procedure SubP (op : out Integer) is >> begin >> op := op+1; >> end SubP; >> I : Integer; >> begin >> SubP (I); >> end Testit; IMHO, Ada83 'out' parameters were cleanly defined, although sometimes unpleasent when the compiler answered 'non-readable', but the Ada95 choice is somewhat ugly (unless am I entirely mistaking), and does not correspond to any intuitive view of 'out'. Here, the intuitive behaviour would be preferably raising Program_error, or any alternate allowed behaviour compatible with the 'non-initialised' 'bounded error'. I guess it is, which I have not checked. This problem is harmless here, but can lead to counterintuitive results when the type implies initialisation (records, controlled types, access types). Intuitively, the actual parameter should be Finalize'd prior to entering the subprogram, and re-Initialize'd as part of elaborating the declarative part of the subprogram ___Is it the behaviour that results from LRM ?___ Apologies in advance if I am mistaking, but I guess it useful to make 'out' clearer than it seems to be. QUESTION : wouldn't it be worth abandoning any use of 'out' parameters ? ---------- ---------- ---------- ---------- Michel Gauthier / Laboratoire d'informatique 123 avenue Albert Thomas / F-87060 Limoges telephone +33 () 55457335 [or ~ 7232] fax +33 () 55457315 [or ~7201] ---------- ---------- ---------- ---------- La grande equation de la fin du siecle : windows-X = Mac-Y The main end-of-century equation : windows-X = Mac-Y ---------- ---------- ---------- ---------- Si l'an 2000 est pour vous un mysticisme stupide, utilisez la base 9 If you feel year 2000 a stupid mystic craze, use numeration base 9 ---------- ---------- ---------- ----------