In C++11's language feature list there is:
Minimal support for garbage collection and reachability-based leak detection
(but it seems not implemented in either GCC and Clang.)
Why the standard committee introduced this garbage collection C++ langauge feature?
Does C++ really need a GC? Isn't RAII such an excellent pattern (that can be used uniformly for both memory and non-memory resources, like sockets, files, textures...)?
Will a GC break the uniformity of C++ code pattern that uses RAII?
Some people say that a GC can come in handy to break circular dependencies, but isn't it just OK to use smart pointers like weak_ptr
for this purpose?
And what happens in case of exceptions thrown? How will the stack unwind semantics be modified to take a GC into consideration?
And will a C#-like IDisposable
pattern be introduced as well?
Moreover, assuming that a GC is introduced in C++, will the pointer syntax be different? e.g. Will we have some hat-like "pointers"^
like in C++/CLI or C++/CX extensions? There should be a way to differentiate from ordinary raw pointers vs. "managed" pointers, right?