|
|
|
|
|
by jstimpfle
16 days ago
|
|
>> Move it, so simple, pointer invalidation. > It works for everyone else, I'm not sure why this is controversial. Show the evidence. It does not. It introduces vast amounts of complexity. So much that they were thinking they had to extend the syntax. Great, from rule of 3 to 7, from 41 ways to blow your leg off to 118 ways. I'm betting it means you can easily google LOTS of memory bugs stemming from this complexity. It "just works" for everyone else, until it does not, and then nobody understands what's wrong because they created a complexity monster. And what do you think how many intended "moves" get silently converted into copies because some failure to properly forward rvalue references and similar? |
|
The evidence is that everyone could do what you showed and they don't, they do this instead. In my experience memory ownership bugs are almost non-existent, an entire class of problems is wiped out.
It's clear that since you're asking about this stuff you haven't actually gone down this road yourself, which means that you're railing against something you don't understand out of fear of something different.
Not difficult or complex. In this case you have something that isn't a constructor returning a data structure that contains heap allocation. You don't have to guess at ownership or dig through documentation (if it exists).Keep an open mind, there's a reason people consider old C style archaic.