goto a no-go?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Oct 2 19:21:18 PDT 2013
On 10/2/13 10:06 AM, Dicebot wrote:
> On Wednesday, 2 October 2013 at 16:12:58 UTC, Jesse Phillips wrote:
>> if (word.length)
>> scope(exit) FormatOutput();
>>
>> This is the same as
>>
>> if (word.length)
>> FormatOutput();
>>
>> The `if` introduces a new scope, thus running the code right away.
>
> Oops, shame on me. Too many `static if`s in my life :(
I think it's a common mishap. Might be nice if the compiler disallowed
gramatically an unbraced if/while/etc containing only one scope statement.
Andrei
More information about the Digitalmars-d
mailing list