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!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Ada.Strings.Fixed.Count raises Storage_Error Date: Wed, 29 Jun 2016 20:19:41 +0200 Organization: A noiseless patient Spider Message-ID: References: <57346ac8$0$4570$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 29 Jun 2016 18:19:43 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2b3884a634d8f846e0712b4e3a92507a"; logging-data="28396"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/SafP3Q80nYjHwuJekQai+" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 In-Reply-To: Cancel-Lock: sha1:JaZW04mVrryzuZ+lv72veEGOTnY= Xref: news.eternal-september.org comp.lang.ada:30970 Date: 2016-06-29T20:19:41+02:00 List-Id: Le 29/06/2016 à 19:43, Niklas Holsti a écrit : > Thanks for this information, Jean-Paul. According to your post in > http://computer-programming-forum.com/44-ada/cdf3e22c34c4de36.htm, this > "pathology" was present in Ada 83, but was cured in Ada 95: "It was > related to a function returning a local task object, which is no more > allowed." > > This suggests to me that the definition of Ada 83 was either ambiguous > in this case, or required too much effort from the implementation for > this feature compared to the benefits of the feature, and consequently > the language was changed to eliminate the feature. No, an unexpected consequence of other rules. The logical place to return the space occupied by tasks (including the TCB) is when you leave its master; however, a function (that returned a task type) could return a local task as the return value; therefore, the identity of the task could propagate outside of its master, implying some information had to be kept, and no place to free it. When I reported the problem to Ichbiah, he told me that this was a problem for me, but that he was sure it would be no problem for his compiler. I think he thought that this case could not be tested. But I did write the test for it... > Thus, Rosen's pathology was not tolerated, which seems to be what Robert > Eachus is suggesting, but eliminated. It was eliminated as a side effect of not allowing the return of a local limited object. > The analogous elimination in this case (String with 'Last = > Integer'Last) would be to change the language to define the index > subtype of String to run from 1 to Integer'Last - 1. The alternative, to > correct the library routine to work even in this case, seems better to me. > I don't think there is an analogy with this case. A string indexed up to Integer'Last is a limit case, not a pathology. And with careful programming, the cost of handling correctly limit cases is often minimal (often overestimated until you measure it). -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr