On Friday, 15 September 2017 at 07:24:34 UTC, Jonathan M Davis wrote:
On Friday, September 15, 2017 04:15:57 bitwise via Digitalmars-d-learn wrote:
I translated the headers for FreeType2 to D, and in many cases, enums are used as struct members.

If I declare an extern(C) enum in D, is it guaranteed to have the same underlying type and size as it would for a C compiler on the same platform?

extern(C) should have no effect on enums. It's for function linkage, and enums don't even have an address, so they don't actually end up in the program as a symbol. And since C's int and D's int are the same on all platforms that D supports (we'd have c_int otherwise, like we have c_long), any enum with a base type of int (which is the default) will match what's in C.

- Jonathan M Davis

I'm confused...is it only C++ that has implementation defined enum size? I thought that was C as well.

Reply via email to