Missed scope guard statements

Janice Caron caron800 at googlemail.com
Thu Mar 6 02:47:19 PST 2008


On 06/03/2008, Max Samukha <samukha at voliacable.com.removethis> wrote:
>  if( true ) scope(exit) writef("hello");
>
> is semantically the same as simply
>  if( true ) writef("hello");

For that matter,

    if (true) anything

is the same as

    anything

But I assume "if (condition)" what what was really intended. It seems
to me that one could instead write:

    scope(exit) { if (condition) writef("hello") }

That is, reverse the order of "scope" and "if".


More information about the Digitalmars-d-bugs mailing list