scope() statements and return
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 6 07:54:33 PDT 2014
On 10/4/14 2:45 PM, Shammah Chancellor wrote:
> int main()
> {
> scope(exit) return 0;
> assert(false, "whoops!");
> }
The above smells to me like it should be invalid. Specifically, the
scope(exit) line by itself.
If you want to catch and not propagate an error, you need to use
try/catch directly.
scope(exit|success|failure) is for cleaning up resources, not returning
from the function.
-Steve
More information about the Digitalmars-d
mailing list