Am Mon, 03 Feb 2014 12:22:47 +0000
schrieb "Gopan" <[email protected]>:
> Is it possible to switch off GC during compilation so that I will
> get
> compilation error on every statement that invites GC in?
I would think that parts of druntime/Phobos make use of the GC
at program startup already. And in general any module not on
the compiler command-line when using that switch and with only
a .di file cannot be statically checked.
Even lazy initialization using the GC would not work:
private Foo foo;
@property Foo someThreadLocalFoo()
{
if (foo is null)
foo = new Foo; // <- error
return foo;
}
If you compile that module alone or as part of a library, the
compiler has to assume that some other module will eventually
make use of this function.
--
Marco