WinAPI for druntime and OpenGL for deimos.

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Fri Nov 23 06:03:02 PST 2012


That's exactly how the original WinAPI does it. All handles are pointers to
their own dummy structures. The current druntime WinAPI just aliases all
handle types to HANDLE, which is itself an alias to void*. This is very
wrong.


On Fri, Nov 23, 2012 at 5:58 PM, Vladimir Panteleev <
vladimir at thecybershadow.net> wrote:

> On Friday, 23 November 2012 at 13:57:14 UTC, Vladimir Panteleev wrote:
>
>> If breaking code were not an issue, the best solution would be to make
>> HANDLE a unique, opaque type (like a struct wrapping an intptr_t or void*)
>> - which is exactly how it should be treated. It would need to support
>> assignment/creation from "null" though.
>>
>
> Oh, I think I remembered. I believe the proper solution is to create a
> dummy struct type, and make HANDLE a const pointer to it. Then it cannot be
> confused with other types, but still accepts null assignments.
>



-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121123/dd4a70d4/attachment.html>


More information about the Digitalmars-d mailing list