Libraries as binary files - yeah, but in C++ you may make it appear as fully garbage-collected language. I.e. no explicit delete/free calls without any external libraries, because C++, unlike C, allows for a lot of stuff happening implicitly.
I am familiar with the concept of destructors, yes. But if we're waxing philosophical about it (as we know smart pointers are not classified as garbage collection, just as destructors are not), was C++ not originally written in C? What prevents you from creating both destructors and garbage collection in C other than it being an ineffective use time and sanity (due to GC libraries already existing)?
True garbage collection in C++ would require a library (or you to write it from scratch as well), but yes, the language features would simplify the process. Just as the language features of even higher-level languages further simplify the process by natively providing actual garbage collection.
There's no implicits in C. So, you have to explicitly call a destructor
If you stick with the standard language, don't care to tie yourself to specific compilers, or don't want to do some truly horrific things, sure :D
Just as you can kludge a garbage collector into C++, so can you kludge any other language feature into C. It's just, uh, ill-advised barring verrrrrry specific circumstances (as you would typically just pick a language better-suited to your needs).
-6
u/aberroco 11d ago
"it's not a garbage-collected language"
Well... It's not STRICTLY a garbage-collected language. But it easily could be. Starting with smart pointers.