Enum that can be 0 or null
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 20 18:53:21 PDT 2016
On Friday, 20 May 2016 at 22:10:51 UTC, tsbockman wrote:
>
> Just use null for pointer types, and 0 for integers. D is not
> C; you aren't *supposed* to be able to just copy-paste any
> random C snippet into D and expect it to work without
> modification.
>
> If that's not a satisfactory answer, please show some specific
> examples of code that you don't know how to make work without
> VK_NULL_HANDLE so that I can propose a workaround.
When binding to a C library, it's desirable to have as close to
the original C API as possible so that you *can* drop C snippets
and examples into D code and have them just work. Obviously, 100%
compatibility is not possible, but it is possible to get pretty
close most of the time.
More information about the Digitalmars-d-learn
mailing list