Exception/Error division in D

Don Clugston dac at nospam.com
Mon Jun 4 03:28:53 PDT 2012


On 01/06/12 22:35, Walter Bright wrote:
> On 6/1/2012 11:14 AM, deadalnix wrote:
>> We are talking about runing scope statement and finally when unwiding
>> the stack,
>> not trying to continue the execution of the program.
>
> Which will be running arbitrary code not anticipated by the assert
> failure, and code that is highly unlikely to be desirable for shutdown.

Sorry, Walter, that's complete bollocks.

try {
    assert(x == 2);
} catch(AssertException e)
{
    foo();	
}

is exactly equivalent to:

version (release)
{}
else
{
    if (x!=2) foo();
}

Bad practice, sure. But it's not running arbitrary, unanticipated code.



More information about the Digitalmars-d mailing list