D compiler need -nogc witch and document of library also need nogc button

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Jun 11 16:11:12 UTC 2019


On Tue, Jun 11, 2019 at 02:46:03PM +0000, dangbinghoo via Digitalmars-d-learn wrote:
> On Tuesday, 11 June 2019 at 12:40:39 UTC, Adam D. Ruppe wrote:
> > On Tuesday, 11 June 2019 at 08:59:01 UTC, dangbinghoo wrote:
> > > We need to make sure we use only @nogc API when writing code, not
> > > when running the app.
> > 
> > That's what the @nogc annotation does, statically forces you to only
> > use other @nogc stuff via compiler errors.
> 
> yeah, @nogc does the job. But the problem is that, you need to mark
> all functions, classes, everything you write to manually marked, so if
> compiler supports -nogc, it will helps great.
[...]

Try putting `@nogc:` at the top of each file, like this:

	@nogc:

	struct MyStruct { ... }
	int myFunc(...) { ... }
	// etc.


T

-- 
Never ascribe to malice that which is adequately explained by incompetence. -- Napoleon Bonaparte


More information about the Digitalmars-d-learn mailing list