scope failure

BCS BCS at pathlink.com
Tue Jun 20 08:56:06 PDT 2006


nobody wrote:
> In article <optbfpq9sx23k2f5 at nrage>, Regan Heath says...
> 
>>On Tue, 20 Jun 2006 07:52:00 +0000 (UTC), nobody  
>><nobody_member at pathlink.com> wrote:
>>
>>>i try to learn the scope statements.
>>>
>>>import std.stdio;
>>>
>>>void main() {
>>>{
>>>scope(failure) writefln("5");
>>>//writefln("Hallo");
>>>}
>>>}
>>>
>>>The output from the program is 5. If i comment the writefln in, then it  
>>>only
>>>print Hallo.
>>>Is this the correct behavier?
>>>I have thougt scope(failure) will only execute when the scope exit
>>>abnormaly by throw. The 5 should never be occur by thi example.
>>
>>It seems to trigger when the scope is empty, putting any other valid  
>>statement in the scope with the scope(failure) statement stops the output  
>>of "5". I suspect this is a bug.
>>
>>Regan
> 
> 
> 
> He, funny
> Under dmd 161, it run correct now.
> 
> Thank you
> 
> 



More information about the Digitalmars-d-learn mailing list