Deokjae Lee:

> What's the meaning of the line A?

It creates on the stack a 2-word structure, puts unsigned 3 in one word and in 
the other word puts a pointer to a newly allocated area on the GC-managed heap, 
that can contain 3 integers (plus one bookkeeping byte), so this heap area is 
probably 4 words long or longer.


> Is the array allocated on heap? or stack?

GC heap.


> Is it dynamic or static?

Dynamic.


> I think the line B is not a good style in D,

There are many situations where you want to use heap allocated structs.


> Does the garbage collector concern the object constructed at line B?

The struct gets allocated on the heap managed by the GC.


> Is the line C safe?

Kind of. But not with future garbage collectors. So recently Andrei has 
deprecated the delete statement. Don't use it any more.

Bye,
bearophile

Reply via email to