C to D: please help translate this weird macro

Nick Treleaven nick at geany.org
Thu Sep 21 16:34:41 UTC 2023


On Thursday, 21 September 2023 at 16:28:25 UTC, Nick Treleaven 
wrote:
>     return cast(T*)(cast(void*)(cast(char*)ptr -
>         __traits(getMember, T, member).offsetof)));

There's a trailing `)` that needs removing. Also pretty sure it 
can be simplified to:

     return cast(T*)(cast(char*)ptr -
         __traits(getMember, T, member).offsetof);


More information about the Digitalmars-d-learn mailing list