Conclusions of the exception discussion

Daniel Murphy yebblies at nospamgmail.com
Sat Feb 25 18:17:34 PST 2012


"kennytm" <kennytm at gmail.com> wrote in message 
news:1711314076351895446.251635kennytm-gmail.com at news.digitalmars.com...
>>
>> catch(auto e : E1, E2) { body; }
>> ->
>>
>> catch(E1 e)
>> {
>>   goto catchE2;
>> }
>> catch(E2 e)
>> {
>> catchE2:
>>   body;
>> }
>
> Won't work unless the compiler enforce that 'body' does not use code which
> requires typeof(e) == E2.

Ok, I oversimplified it a bit.  It's more like this:

__set_except_list();
trybody();
goto __try_break;
__exceptionE1:
goto __exceptionE2;
__exceptionE2:
catchbody();
goto __try_break;
__try_break:

And when semantic is run on catchbody, the type of the variable is set to 
the common supertype of all the exceptions in the list. 




More information about the Digitalmars-d mailing list