Skip to content

GC

在阅读cppreference C++11时,无意中发现:

Core language features

原来C++ 11提供了"Garbage collector support"。在Wikipedia C++11#Allow garbage collected implementations 中有相关介绍:

Prior C++ standards provided for programmer-driven garbage collection via set_new_handler, but gave no definition of object reachability for the purpose of automatic garbage collection. C++11 defines conditions under which pointer values are "safely derived" from other values. An implementation may specify that it operates under strict pointer safety, in which case pointers that are not derived according to these rules can become invalid.