3 ms·
Lock-free data structures is a 0.001% niche, which can be implemented as libraries by experts and then used without any trouble by an average Joe programmer. An
by pkolaczk 4y ago
Lock-free data structures is a 0.001% niche, which can be implemented as libraries by experts and then used without any trouble by an average Joe programmer. An average Joe wouldn't get the implementation of them right even in a GC language anyway. Also, in those niche cases, GC is available as an option. But you should not optimize the language for the niche use case.
> Badly implemented destructors, missing virtual destructors in hierachys, throwing exceptions on destructurs, not using handle types on heap allocated data, incorrect pairing of allocators.
Those seem to be more specific problems with C++ rather than RAII. Rust has none of those.
- pjmlp 4y agoThe ongoing issues with Drop trait stabilization show otherwise. Having a GC is an option alongside the other ones, an option that both Epic and Microsoft think it is worth enough money to spend development resources on. And Google as well, actually, as Chrome uses a C++ GC, seen as way to fix security issues, Olipan.
- pkolaczk 4y agoGC as an opt in, next to to RAII - so you can use it when you need it, that's fine. But it is a productivity issue when the only way to manage memory is non-deterministic GC, e.g. like in Java or Go.
- pjmlp 4y agoThat was the original question, why there are GC implementations for C++. Every language with a GC is distinct, and should be properly analysed instead of putting all into the same box.