Struct should be invalid after move

Atila Neves atila.neves at gmail.com
Wed Nov 28 16:49:02 UTC 2018


On Wednesday, 28 November 2018 at 09:17:39 UTC, sanjayss wrote:
> On Tuesday, 27 November 2018 at 08:00:22 UTC, Sebastiaan Koppe 
> wrote:
>> [...]
>
> I have always wanted a feature in C that would let me 
> explicitly tell the compiler that a variable is no longer in 
> scope (some sort of unset of a variable). This would be useful 
> to do defensive programming against use-after-free of pointers 
> to allocated memory and such.


{
     void* ptr = malloc(5);
}

// ptr no longer in scope



More information about the Digitalmars-d mailing list