Consensus on goto's into catch blocks

Iain Buclaw ibuclaw at ubuntu.com
Thu Jun 13 13:40:14 PDT 2013


On 13 June 2013 20:18, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> On Thu, Jun 13, 2013 at 11:50:49AM -0700, Brad Roberts wrote:
>>
>> I think it should be illegal, but not because it's a catch block but
>> because of the initialization.  If the catch was just "catch
>> (Exception)" then it shouldn't be illegal.
>
> Why shouldn't it be illegal, though? I honestly don't see any use case
> for such a strange construct. Not to mention, like monarch_dodra said,
> if the anonymous Exception's reference is on the stack, then at the end
> of the catch block there'd be code to adjust the stack pointer, which
> will trash your stack pointer horribly if we goto the middle of the
> block bypassing the stack allocation of the Exception reference.
>

Thank goodness D's exceptions are all heap allocated!

--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list