On 1/7/2012 11:00 AM, Froglegs wrote:
For a GC to be used at the C++/D layer it would need to be
1) optional always, D makes it optional but you loose a solid chunk of the
language if you ditch GC, what remains is in some ways inferior to C++(no
escaping lambda without GC, /cry)
2) no long pauses ever
I think most game engine stuff will continue to be written without GC, as it
doesn't really add much if what you are after is raw performance. And C++ does
have smart pointers which perform much of what a GC does, but without the long
pauses or non deterministic destruction.
There are more options with D:
3) Disable GC from collecting during critical parts of the code, i.e. you can
still new all you want, it just won't run collection cycles.
4) Pre-allocate all necessary data before entering the critical sections. You
have to do this anyway with C++ if you have hard realtime constraints, as C++
makes no guarantees about how long new or malloc() will take (and it cannot).
BTW, in C++ a lambda cannot escape, so C++ has no advantage there.