extern(C) enum

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 15 06:57:31 UTC 2017


On 15/09/2017 5:15 AM, bitwise 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?

No need for extern(C). Be as specific as you need, but most likely you 
won't need to (e.g. first is automatically 0).

enum Foo : int {
	Start = 0,
	StuffHere
	End
}



More information about the Digitalmars-d-learn mailing list