D and Secure Programming

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 2 21:30:29 PDT 2016


On Monday, 3 October 2016 at 03:50:29 UTC, Jacob wrote:
>     import std.stdio;
>
>     struct SomeStruct
>     {
>         int value;
>
>         void func()
>         {
>             writeln(value);
>         }
>
>     }
>
>     void main()
>     {
>         SomeStruct someStruct;
>         someStruct.value = 333;
>
>         auto func = cast(void function(ref 
> SomeStruct))&SomeStruct.func;
>
>         func(someStruct);
>     }
>
> Has worked so far for me.

But it can be useful to take the address of the code and to patch 
the "this" pointer of a delegate later. Used several times.

What's the plan ? to disable this ! Plz no.


More information about the Digitalmars-d mailing list