Proposal 2: Exceptions and @nogc
Dukc via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 9 01:35:24 PDT 2017
On Sunday, 9 April 2017 at 03:26:14 UTC, Walter Bright wrote:
> The only place a refcounted Throwable is ever created is when
> the following
> statement is in the user code:
>
> throw new E(string);
object aMemoryLeak;
void someFunc()
{ throw (aMemoryLeak = new Exception("hello world!"));
}
Would the compiler warn about this or make the exception normally
garbage collected?
I'm not sure, but perhaps an entirely different syntax would be
in place for throwing a refcounted object, so there's no special
casing. For example, could a throw statement without the new
keyword mean a refcounted throw?
More information about the Digitalmars-d
mailing list