Remix.run Logo
▲ throwitaway222 4 hours ago

I remember back in the day in Windows C++ programming everything was a HANDLE memory is probably not serving me, but they were all really just void* renamed. And you use them with various win32 functions I guess to keep things straight. I don't miss those days.

▲delta_p_delta_x 4 hours ago | parent | next [-]

> but they were all really just void* renamed

The good thing is that all of these can and have been quite neatly put into RAII[1] or some memory arena with custom deleters which use the Win32 functions. One could manually `delete` those handles, but there be dragons. Vulkan does something similar; everything is a VkSomething handle. They may just be pointers directly exposed by the driver, but even so, users are explicitly supposed to use vkDeleteSomething functions to delete them.

[1]: https://github.com/microsoft/wil

▲andrewshadura 4 hours ago | parent | prev [-]

Famously Win16 API required locking memory allocations to be able to access them by a pointer. Unlocked allocations could be moved by the OS.