Consensus on goto's into catch blocks
monarch_dodra
monarchdodra at gmail.com
Thu Jun 13 12:08:38 PDT 2013
On Thursday, 13 June 2013 at 18:51:01 UTC, Brad Roberts wrote:
> On 6/13/13 10:35 AM, Iain Buclaw 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.
Again for what it's worth, the C++ program with "catch(...)" also
fails.
Even if the variable is unnamed though, doesn't the code still
cross the declaration, which is enough to make a mess of things?
I mean, the caught exception is still on the stack somewhere,
right?
And still, if, by some hoops, we could make it work, do we really
want to add that functionality? I mean, would it really even be
useful?
That, and I'm not a fan to having code that breaks just because
you later decided to name a variable.
Eg:
before:
catch(Exception) //OK
after
catch(Exception e) //Nope, that's illegal now. Good luck finding
out why!
More information about the Digitalmars-d
mailing list