Purpose of template DECLARE_HANDLE in druntime

Andre Pany andre at s-e-a-p.de
Tue Feb 26 18:58:17 UTC 2019


On Friday, 1 February 2019 at 08:12:23 UTC, Andre Pany wrote:
> On Friday, 1 February 2019 at 07:35:34 UTC, Kagamin wrote:
>> It's a strong typed handle, in C it's declared as
>>
>> #ifdef STRICT
>> typedef void *HANDLE;
>> #if 0 && (_MSC_VER > 1000)
>> #define DECLARE_HANDLE(name) struct name##__; typedef struct 
>> name##__ *name
>> #else
>> #define DECLARE_HANDLE(name) struct name##__{int unused;}; 
>> typedef struct name##__ *name
>> #endif
>> #else
>> typedef PVOID HANDLE;
>> #define DECLARE_HANDLE(name) typedef HANDLE name
>> #endif
>
> Thanks for all answers.
> I understand, there was a reason in the past, but now
> it is a superfluous construct.
> I will create an issue and after that checks whether I can
> create a pull request.
>
> Kind regards
> André

Issue created
https://issues.dlang.org/show_bug.cgi?id=19702



More information about the Digitalmars-d-learn mailing list