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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,75a8a3664688f227 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-09 07:15:04 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!195.25.12.36.MISMATCH!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: "Thierry Lelegard" Newsgroups: comp.lang.ada Subject: Re: Parameter Modes, In In Out and Out Date: Tue, 9 Jan 2001 16:15:54 +0100 Organization: Guest of France Telecom Oleane's newsreading service Message-ID: <93f9pi$uaa$1@s1.read.news.oleane.net> References: <937haq$mmh$1@wanadoo.fr> NNTP-Posting-Host: host226.canal-plus.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: s1.read.news.oleane.net 979053170 31050 194.2.208.226 (9 Jan 2001 15:12:50 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Tue, 9 Jan 2001 15:12:50 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Xref: supernews.google.com comp.lang.ada:3817 Date: 2001-01-09T16:15:54+01:00 List-Id: > procedure P (X : out Some_Type); > > By looking at the specification (NOT the body), I can tell that the > procedure cannot rely on the previous value of the parameter, > and therefore that it is safe to call it to initialize an > unitialized variable, whose value can be invalid. I could not assume this > with an in out parameter. This is quite true, especially with floating point types for which some binary patterns are NaN (Not a Number), ie. invalid values. On some architectures (I remember the old time of the VAX), passing an uninitialized variable as "in out" may raise an exception _even_if_the_procedure_never_reads_the_input_value_. The by-copy semantic generates a MOVF ("move F_float") instruction for "in" and this instruction generates a trap if the binary pattern is an invalid floating point value. So, Jean-Pierre Rosen is right, never use "in out" for "out" when you cannot be sure that the actual parameter is properly initialized. ____________________________________________________________________________ Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr CANAL+ Technologies, 34 place Raoul Dautry, 75516 Paris Cedex 15, France Tel: +33 1 71 71 54 30 Fax: +33 1 71 71 52 08 Mobile: +33 6 03 00 65 75 ____________________________________________________________________________