Re: What does @nogc do to a class?

2021-05-08 Thread Jack via Digitalmars-d-learn
On Thursday, 6 May 2021 at 22:16:04 UTC, Per Nordlöw wrote: On Thursday, 6 May 2021 at 01:04:02 UTC, Jack wrote: Does it allocate the object rather on stack, like auto scope a = new A or what? Further note that auto scope a = new A; can be written shorter as scope a = new A; I'll

Re: What does @nogc do to a class?

2021-05-06 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 6 May 2021 at 01:04:02 UTC, Jack wrote: Does it allocate the object rather on stack, like auto scope a = new A or what? Further note that auto scope a = new A; can be written shorter as scope a = new A;

Re: What does @nogc do to a class?

2021-05-06 Thread Jack via Digitalmars-d-learn
On Thursday, 6 May 2021 at 02:11:27 UTC, Mike Parker wrote: On Thursday, 6 May 2021 at 01:04:02 UTC, Jack wrote: Does it allocate the object rather on stack, like auto scope a = new A or what? It doesn't do anything to classes. `@nogc` prevents you from any action triggers a GC allocation,

Re: What does @nogc do to a class?

2021-05-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 May 2021 at 01:04:02 UTC, Jack wrote: Does it allocate the object rather on stack, like auto scope a = new A or what? It doesn't do anything to classes. `@nogc` prevents you from any action triggers a GC allocation, such as using `new, so you would need to allocate from

What does @nogc do to a class?

2021-05-05 Thread Jack via Digitalmars-d-learn
Does it allocate the object rather on stack, like auto scope a = new A or what?