logoalt Hacker News

canypyesterday at 7:37 PM1 replyview on HN

GP picked the less useful of the two examples. The other one is a use-after-move, which static analysis won't catch beyond trivial cases where the relevant code is inside function scope.

I also agree with them: I am pro-C++ too, but the current standard is a fucking mess. Go and look at modules if you haven't, for example (don't).


Replies

nlyyesterday at 11:42 PM

No type is safe to use after a move, unless it's documented to put itself in to a well defined state and says as such

You can't magically make all the member functions on std::vector safe after a move for example unless the moved from vector allocates itself a new (empty) buffer, which kills the performance benefits.

It's all by design.