2 ms·
By bells and whistles, do you mean smart pointers that have been around for decades and destructors? I have a codebase that I ported from C# to C++ and found a
by 72deluxe 4y ago
By bells and whistles, do you mean smart pointers that have been around for decades and destructors?
I have a codebase that I ported from C# to C++ and found a few bugs where the items were copied instead of moved. In C# this was completely invisible since I "trusted" the compiler to do it properly - it did it wrong according to my wishes but right compared to the language.
By contrast in C++ it was very visible when the ownership was shared and wrong. I would rather use C++ because of this rather than trusting the compiler to get it right.
The same was true on generics/templates for a function/parameter system I'd written. The C# compiler resolved to the wrong function every single time but in C++ it resolved correctly.
I suspect there are plenty of subtleties in "safe" languages that actually muddy concepts of owernship and/or needless copying and lifetimes.
- Yoric 4y ago> I suspect there are plenty of subtleties in "safe" languages that actually muddy concepts of owernship and/or needless copying and lifetimes. True in my experience. However, not the case in Rust, which is actually much more explicit about ownership, copying and lifetimes than C++.
- 72deluxe 4y agoVery interesting. I will read more. Thanks!
- hardware2win 4y ago>where the items were copied instead of moved. Uh? What was being done there?