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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Uninitialized out parameters. Date: Wed, 6 Apr 2016 23:41:24 +0300 Organization: Tidorum Ltd Message-ID: References: <3be79ab3-ebc7-4169-9713-d50349662403@googlegroups.com> <70a76f87-51a9-4e77-9fa0-79714f9c0ba7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net tug/oSEi+tABVBE3+qZbXQhjAW9O98PFaRCUuZrRRFyLKKeAcs Cancel-Lock: sha1:lpSl9Rjv3ZUw+6IsURrH/lZePFM= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:30016 Date: 2016-04-06T23:41:24+03:00 List-Id: On 16-04-06 14:44 , Dennis Lee Bieber wrote: > On Wed, 6 Apr 2016 12:17:05 +0200, "G.B." > declaimed the following: > >> 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. >> > Which could be a case if the compiler used copy-in/copy-out semantics > for scalars (or just copy-out for the test sample). GNAT, if I recall, uses > reference semantics, Then GNAT would be in violation of the Ada standard -- see RM 6.2(3/3). I hope and believe that is not the case... -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .