C header file: tagged enumerations

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 26 15:57:36 PDT 2016


Windows tends to have these in their header files, what is the 
best way to translate them to D?

https://msdn.microsoft.com/en-us/library/whbyts4t.aspx

Example below. In general a named enum is close enough to the 
same thing, but this example has additional enumerations added 
based on the preprocessor.

Assuming _WIN32_MSI is defined for compile time, what is 
recommended for creating this enum?

typedef enum tagINSTALLMESSAGE
{
// 12 others ...
	INSTALLMESSAGE_INITIALIZE     ,
	INSTALLMESSAGE_TERMINATE      ,
	INSTALLMESSAGE_SHOWDIALOG     ,
#if (_WIN32_MSI >= 500)
	INSTALLMESSAGE_PERFORMANCE    ,
#endif // (_WIN32_MSI >= 500)
#if (_WIN32_MSI >= 400)
	INSTALLMESSAGE_RMFILESINUSE   ,
#endif // (_WIN32_MSI >= 400)
#if (_WIN32_MSI >= 450)
	INSTALLMESSAGE_INSTALLSTART   ,
	INSTALLMESSAGE_INSTALLEND     ,
#endif // (_WIN32_MSI >= 450)
} INSTALLMESSAGE;



More information about the Digitalmars-d-learn mailing list