From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Variable value if exception is raised Date: Sun, 20 Nov 2022 20:00:32 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 20 Nov 2022 19:00:33 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="f2ae079dae55ba6daa03ced8584b99bc"; logging-data="3752028"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Mmzi7YCIHRKJRWgrRbNiD7UNfv5S4iPQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cancel-Lock: sha1:ONFIPnP484gCWrUjsPSSRtMNoA8= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:64636 List-Id: On 2022-11-20 19:03, nytpu wrote: > > If an exception is *explicitly* raised during a variable assignment, what > happens to the variable contents? Are they in an undefined ("abnormal") > state, or are the previous contents preserved? If the exception occurs during evaluation of the RHS, as in your example, then the language guarantees that the value of the LHS is unchanged. The execution of the assignment statement is abandoned before the value of the LHS is changed. If an exception is raised while adjusting a controlled LHS, then the value of the LHS has already been changed before the exception is raised. > -- insert a nested handler, because the ARM § 11.4 ¶ 3 *does* > -- say that the currently executing body is "abnormally > -- completed" (including finalizing everything) before > -- entering the exception handler This comment is false. Finalization does not occur until the exception handler finishes. Exception handlers would be pretty useless otherwise. -- Jeff Carter "English bed-wetting types." Monty Python & the Holy Grail 15