comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: Variable value if exception is raised
Date: Sun, 20 Nov 2022 20:00:32 +0100	[thread overview]
Message-ID: <tldtgh$3ig2s$1@dont-email.me> (raw)
In-Reply-To: <tldq4n$3i1p2$1@dont-email.me>

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

      reply	other threads:[~2022-11-20 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 18:03 Variable value if exception is raised nytpu
2022-11-20 19:00 ` Jeffrey R.Carter [this message]
replies disabled

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