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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Uninitialized out parameters. Date: Wed, 6 Apr 2016 12:17:05 +0200 Organization: A noiseless patient Spider Message-ID: References: <3be79ab3-ebc7-4169-9713-d50349662403@googlegroups.com> <70a76f87-51a9-4e77-9fa0-79714f9c0ba7@googlegroups.com> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 6 Apr 2016 10:13:44 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="31178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UCA47jsiZKXaDC78QQuZ2YM9igiALWDM=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <70a76f87-51a9-4e77-9fa0-79714f9c0ba7@googlegroups.com> Cancel-Lock: sha1:9HRSm0h/lVOFeHmoyQ9XDnVjMNg= Xref: news.eternal-september.org comp.lang.ada:30006 Date: 2016-04-06T12:17:05+02:00 List-Id: On 06.04.16 10:19, ahlan@marriott.org wrote: > On Tuesday, April 5, 2016 at 6:19:47 PM UTC+2, G.B. wrote: >> On 05.04.16 14:02, ahlan@marriott.org wrote: >>> Ada.Text_IO.Put_Line ("V:" & V'img); >>> >>> The value zero is output, which because V is positive should be impossible. >> >> Addressing just this issue: the line is calling >> implementation defined attribute 'IMG, which can >> do as it pleases. The Ada type attribute 'Image >> takes a value of type Positive'Base, which includes 0, >> which is why outputting 0 is perfectly fine. >> >> (It's not a subtype attribute, but a type attribute, >> if this makes sense.) > > The issue here is not whether or not 'img fails but the fact that V is returned with a value out of range. The issue is rather, I think, whether V is returned at all. There would have to be an assignment within the null procedure. > But even that is not the point I'm trying to make. > I am suggesting that it ought not to be possible to define a null procedure that has out parameters without some form of warning being issued. I think the usual answer is that the compiler is not a mind reader and the best you could get is a warning. Who knows? Maybe the technical requirements are such that the programmer uses a procedure like Test as a placeholder, maybe its existence is dictated by an abstract type, maybe a null procedure really should do nothing at all, which includes not touching V.