C to D: please help translate this weird macro

Ki Rill rill.ki at yahoo.com
Fri Sep 22 12:26:29 UTC 2023


On Thursday, 21 September 2023 at 16:50:51 UTC, Imperatorn wrote:
> On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote:
>> Here is the macro:
>>
>> ```C
>> #define NK_CONTAINER_OF(ptr,type,member)\
>>     (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - 
>> NK_OFFSETOF(type, member)))
>> ```
>>
>> I'm trying to translate the Nuklear GUI library to D 
>> [here](https://github.com/rillki/nuklear-d/tree/nuklear-d-translation).
>
> When you're done, will you put it on dub?

Yes, I will.


More information about the Digitalmars-d-learn mailing list