From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Did I find a bug here? Date: Sat, 3 Apr 2021 11:18:47 +0300 Organization: Tidorum Ltd Message-ID: References: <6901cec3-b7b1-48c8-98fe-0360572175c2n@googlegroups.com> <2bb293da-8c8d-471c-ab0a-93fbc0033485n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net aOq1snfdm1BhJMVm/BLMKg5ymyZkhY90wuFUG8OwTodFM8BLEc Cancel-Lock: sha1:/1xCkjDosgcOiBYVFRZPTxOuer8= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61732 List-Id: On 2021-04-03 9:41, J-P. Rosen wrote: > Le 03/04/2021 à 07:46, reinert a écrit : >> Could AB_Type(X) in "case AB_Type(X) is" function as such a valid check? > Yes, I believe not. The use of X as an argument to a type conversion is an "evaluation" of X, by RM 4.6(28), which can be a bounded error by RM 13.9.1(9) if X'Valid is False. That bounded error can lead to an exception or simply to continued execution with the invalid value. > but I recommend "case AB_Type'(X) is", i.e. a qualification rather > than a conversion. That also requires an evaluation of X, by RM 4.7(4), and again can be a bounded error if X'Valid is False. The use of X in X'Valid is explicitly defined to mean that X is "read" but is not "evaluated", RM 13.9.2(12)(13). So it seems to be the only safe way to check for validity.