10 ms·
By that definition C++ is also garbage collected and managed. Given that C++ is oft cited as the canonical unmanaged non-GCed language, this seems like a not ve
by Diggsey 5y ago
By that definition C++ is also garbage collected and managed. Given that C++ is oft cited as the canonical unmanaged non-GCed language, this seems like a not very useful definition.
(And you can call `alloc` and `free` from Rust, https://doc.rust-lang.org/std/alloc/fn.alloc.html https://doc.rust-lang.org/std/alloc/fn.alloc.html)
It's also weird that you call out `Rc` specifically. `Box` also allocates and free memory, as does `Vec` and other types from the `alloc` crate.
- pjmlp 5y agoActually, like everything in computing, it depends. Reference counting is a form of garbage collection, as per most highly referenced CS books on the subject, like The Garbage Collection Handbook, chapter 5. https://gchandbook.org/ https://gchandbook.org/ But lets put that aside, considering that std::..._ptr<>() or any other variant thereof are plain optional library types. That still leaves Unreal C++, C++/CLI, C++/CX as garbage collection extensions to C++, just like GCC C++ or clang C++ provide their own language extensions. https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Objects/Optimizations/ https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScrip... https://docs.microsoft.com/en-us/cpp/dotnet/dotnet-programming-with-cpp-cli-visual-cpp?view=msvc-160 https://docs.microsoft.com/en-us/cpp/dotnet/dotnet-programmi... https://docs.microsoft.com/en-us/cpp/cppcx/visual-c-language-reference-c-cx?view=msvc-160 https://docs.microsoft.com/en-us/cpp/cppcx/visual-c-language...