scope() statements and return

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 5 04:28:59 PDT 2014


On Saturday, 4 October 2014 at 18:42:05 UTC, Shammah Chancellor 
wrote:
> Didn't miss anything.  I was responding to Andrei such that he 
> might think it's not so straightforward to evaluate that code.
>  I am with you on this.  It was my original complaint months 
> ago that resulted in this being disallowed behavior.  
> Specifically because you could stop error propigation by 
> accident even though you did not intend to prevent their 
> propigation.  e.g:
>
> int main()
> {
> 	scope(exit) return 0;
> 	assert(false, "whoops!");
> }
>
> -S

Isn't this the "should scope(exit/failure) catch Error" issue 
though?

In theory, you should seldom ever catch Errors. I don't 
understand why "scope(exit)" are catching them.


More information about the Digitalmars-d mailing list