Enum that can be 0 or null

tsbockman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 20 23:13:04 PDT 2016


On Saturday, 21 May 2016 at 01:53:21 UTC, Mike Parker wrote:
> 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.

The reason that VK_NULL_HANDLE cannot (currently) be directly 
implemented in D it is not type safe.

D's type safety is usually considered to be a positive selling 
point for the language; that's what I mean when I say that "you 
aren't *supposed* to be able to just copy-paste any random C 
snippet into D".


More information about the Digitalmars-d-learn mailing list