goto a no-go?
deadalnix
deadalnix at gmail.com
Wed Oct 2 20:14:20 PDT 2013
On Thursday, 3 October 2013 at 02:21:19 UTC, Andrei Alexandrescu
wrote:
> 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
Or more generally cope statement at the end of a scope.
More information about the Digitalmars-d
mailing list