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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.17.43 with SMTP id 40mr16036205qgc.4.1459950247455; Wed, 06 Apr 2016 06:44:07 -0700 (PDT) X-Received: by 10.182.214.98 with SMTP id nz2mr466315obc.4.1459950247415; Wed, 06 Apr 2016 06:44:07 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!10no681475qgg.1!news-out.google.com!ha2ni203igb.0!nntp.google.com!nt3no8293834igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 6 Apr 2016 06:44:07 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:120b:7f3:dcd0:64aa:9bd2:6ac4:5f7c; posting-account=DQbqYQoAAACn8hHn2LmG2aF7Mhbxl_Lf NNTP-Posting-Host: 2a02:120b:7f3:dcd0:64aa:9bd2:6ac4:5f7c References: <3be79ab3-ebc7-4169-9713-d50349662403@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Uninitialized out parameters. From: ahlan@marriott.org Injection-Date: Wed, 06 Apr 2016 13:44:07 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2669 X-Received-Body-CRC: 3314545069 Xref: news.eternal-september.org comp.lang.ada:30009 Date: 2016-04-06T06:44:07-07:00 List-Id: On Wednesday, April 6, 2016 at 1:37:41 PM UTC+2, AdaMagica wrote: > Hm, from the point of view of the RM, the RM has nothing to say about war= nings - only whether the code is legal or illegal. So giving warnings is up= to the compiler. >=20 > Now for scalar variables, the RM says, in mode variables are copied in, o= ut mode variables are copied out, in out variables are both. So as I unders= tand, even a null procedure with an out parameter does something to the par= ameter: it copies out an uninitialized variable (which can have any value w= hatsoever). Language lawyers - please? In the annotated RM, in the section concerning Null Procedures, it says "Th= ere are no null functions because the return value has to be constructed so= mehow; a function that always raises Program_Error doesn't seem very useful= or worth the complication" If there are no null functions because a return value has to be constructed= then surely the same applies to null procedures that have out parameters. = These too should be prohibited because they too require that a value has to= be constructed. If not prohibited then at least Program_Error should be ra= ised and ideally a warning is generated by the compiler warning that callin= g the null procedure will always raise Program_Error. Currently GNAT simply returns "something" - zero or null that sometimes esc= apes detection. This is NOT desirable.