Struct should be invalid after move
John Colvin
john.loughran.colvin at gmail.com
Wed Nov 28 11:24:35 UTC 2018
On Wednesday, 28 November 2018 at 09:30:21 UTC, Sebastiaan Koppe
wrote:
> 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.
Sure, catching some simple cases is definitely doable, if someone
has the compiler chops (or is prepared to learn) and some time to
dedicate to it.
I suspect if it was a small code change and had a zero
false-positive rate (I.e. only caught things that *definitely*
were wrong) then it would be accepted. Large code change ->
uncertain. Any false positives that forbid valid programs ->
unlikely to be accepted.
That's just my feeling though, who knows....
More information about the Digitalmars-d
mailing list