goto a no-go?

deadalnix deadalnix at gmail.com
Wed Oct 2 22:26:15 PDT 2013


On Thursday, 3 October 2013 at 03:37:27 UTC, Andrei Alexandrescu 
wrote:
> I'm cautious about that; that's why I specified "unbraced". 
> Consider:
>
> if (lily)
> {
>     scope(exit) writeln("Lily was here.");
>     // fun();
> }
>
> This code is a plausible edit of work that was meaningful and 
> in which the programmer has temporarily commented out the call 
> to fun. If the compiler would obnoxiously protest that the 
> edited code can't compile, that may be more aggravation than 
> win for the user.
>

It is also fairly common to add control flow that make code 
unrechable in dev (or when playing with static ifs). And it is 
disallowed.


More information about the Digitalmars-d mailing list