3 ms·
True, but at a cost. As far as I can tell, C++ programmers have stopped caring about the cost of copying objects at every function/method boundary, every time c
by notacoward 8y ago
True, but at a cost. As far as I can tell, C++ programmers have stopped caring about the cost of copying objects at every function/method boundary, every time containers are used (which is a lot), in lambdas, etc. Memory safety is easy that way. Yes, some modern C++ code is very careful about this stuff, but the common idioms all seem to be pulling in the opposite direction.
I still think there's room for a system language that manages to be memory-safe without all the cruft (std::move my ass) and inefficiency. Is Rust that language? Not really sure. D and Zig and even Nim all seem closer to my own ideal, but they don't have anywhere near the mindshare.
- gumby 8y agoQuite the opposite: move semantics are pervasive throughout the library and other idioms; making a lambda without copy is pretty canonical too (though if you're going to use it with locals after returning from the stack frame you'll inherently have to copy in any language!). And it is very easy to write templates that use this behavior so users don't have to think of it. In C++20 the syntax for this will be very simple (less garish than the old <> syntax).
- notacoward 8y agoMaybe you've been working on different codebases than I have. Whatever might be in the libraries, what I see among the users of those libraries is a ton of careless copying. The idiom is what the majority do, not what some authority says they should do.