extern(C) enum
Mike Parker
aldacron at gmail.com
Mon Sep 18 00:12:49 UTC 2017
On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote:
> On Sunday, 17 September 2017 at 18:44:47 UTC, nkm1 wrote:
>> On Sunday, 17 September 2017 at 17:06:10 UTC, bitwise wrote:
>>> [...]
>>
>> Just put the burden on the users then. It's implementation
>> defined, so they are in position to figure it out...
>
> This isn't something that can really be done with bindings,
> which are important for D to start really picking up speed.
>
> If someone goes to code.dlang.org and decides to download some
> FreeType2 bindings, they should just work. The memory
> corruption bugs that could occur due to binary incompatibility
> with some random copy of the original C library would be
> extremely hard to diagnose. They would also undermine the
> memory safety that a lot of people depend on when using D.
>
I've been maintaining bindings to multiple C libraries (including
Freetype 2 bindings) for 13 years now. I have never encountered
an issue with an enum size mismatch. That's not to say I never
will.
I would say it's something you just don't have worry about. If,
at some future time, any C compiler on any platform decides to
start treating enums as something other than int or uint by
default, then we can report a bug for D and fix it.
More information about the Digitalmars-d-learn
mailing list