comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Did I find a bug here?
Date: Sat, 3 Apr 2021 11:18:47 +0300	[thread overview]
Message-ID: <icqmn8F3h91U1@mid.individual.net> (raw)
In-Reply-To: <s492mr$d5e$1@dont-email.me>

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.

  reply	other threads:[~2021-04-03  8:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  6:30 Did I find a bug here? reinert
2021-04-02  7:30 ` J-P. Rosen
2021-04-02  8:33   ` Niklas Holsti
2021-04-03  5:46     ` reinert
2021-04-03  6:41       ` J-P. Rosen
2021-04-03  8:18         ` Niklas Holsti [this message]
2021-04-03 12:37           ` J-P. Rosen
  -- strict thread matches above, loose matches on Subject: below --
2021-04-02  6:15 reinert
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox