Noob question about structs allocation

IM 3di at gm.com
Mon Oct 15 03:19:07 UTC 2018


I probably used to know the answer to this question, but it's 
been a long time since I last used D, and I don't remember. 
Suppose we have:

struct S {
   int num;
}

Would allocating an instance on the heap using:

S* s = new S;

use the GC, or do we have to call destroy() or delete on s 
ourselves?


More information about the Digitalmars-d-learn mailing list