std library hooks

Jacob Carlborg doob at me.com
Sun Apr 15 04:36:50 PDT 2012


On 2012-04-14 21:49, Walter Bright wrote:
> On 4/14/2012 3:57 AM, Jacob Carlborg wrote:
>> Can I throw anything? A catchable exception ?
>
>
> The compiler internally regards the assert function as "does not
> return". So do whatever you want in it, as long as you do not return
> normally from it. That means exit the program or throw something.
>
> But if you throw a catchable exception, what if it gets caught? Your
> program is now in an invalid state. I wouldn't do that.

This is for running unit tests. It's a workaround because currently the 
whole application terminates when an assert error is thrown when running 
unit tests.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list