Struct should be invalid after move

kinke noone at nowhere.com
Tue Nov 27 22:49:44 UTC 2018


On Tuesday, 27 November 2018 at 19:51:12 UTC, Manu wrote:
> The language goes to great effort to return everything to it's 
> `init`
> state after being moved or destroyed. The whole point of that 
> is to
> cover the cases you are concerned about here.
> If it was invalid to access a thing after it's moved (or after
> destruction), then there's no reason for any of the work that 
> resets
> thing to their `init` to happen... that's quite a different set 
> of
> language semantics.

Yeah, I also totally fail to see a reason why a moved-from 
instance should be treated any different than a default-allocated 
one. Ownership taken away, reset to init, memory obviously still 
claimed and accessible as long as in scope.


More information about the Digitalmars-d mailing list