Struct should be invalid after move

Sebastiaan Koppe mail at skoppe.eu
Wed Nov 28 09:30:21 UTC 2018


On Wednesday, 28 November 2018 at 09:11:48 UTC, Stefan Koch wrote:
> So ... what you want is this:
>
> "Compiler, ensure that there is no possible execution-flow path 
> in which this variable is ever set to 0."

Almost. I want to prevent usage *after* it is set to 0. Similar 
to how the compiler already recognises this error:

---
void main() {
   int* p = null;
   (*p) = 5;  // <- Error: null dereference in function _Dmain
}
---

Which more and more languages already provide. Swift, Kotlin etc.


More information about the Digitalmars-d mailing list