Re:The Pragmatic C++ Programmer
by Guvante on Tuesday May 12, 2015 @05:07PM
(#9534886)
> So, why did managed language designers decide to use heap allocation for reference type objects?
Because you avoid having to think about where to put the object while also not eating the cost of copying it if you guess wrong.
The lifetime of a heap object is whatever you define the lifetime to be (which thanks to GC is very flexible) the lifetime of a stack object has an absolute maximum.
Because you avoid having to think about where to put the object while also not eating the cost of copying it if you guess wrong.
The lifetime of a heap object is whatever you define the lifetime to be (which thanks to GC is very flexible) the lifetime of a stack object has an absolute maximum.