Assert and the optional Message

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 9 22:09:02 PST 2012


On Friday, March 09, 2012 22:48:25 Timon Gehr wrote:
> On 03/09/2012 10:43 PM, Jonathan M Davis wrote:
> ...
> 
> >> Jonathan is just speculating. And I think he is wrong.
> > 
> > Speculating about what?
> > 
> > - Jonathan M Davis
> 
> About how assertion failures affect struct destructors, finally
> statements and scope statements. If they wouldn't be executed upon
> thrown AssertError, then a _passing_ in contract could screw up the
> program state. Furthermore, the implementation does execute them.

It's not speculation. There's no guessing involved. It's what I've understood 
the rules of the language to be.

But I asked on dmd-internals to verify it, and Walter has stated that it just 
so happens that  the destructors, scope statements, and finally blocks do 
currently get run for non-Exception exceptions, but it's not guaranteed:

http://forum.dlang.org/post/4F5AE8EC.4040408@digitalmars.com

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list