C header file: tagged enumerations

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 28 15:54:10 PDT 2016


On Thursday, 28 April 2016 at 08:54:45 UTC, Kagamin wrote:
> enum
> {
> // 12 others ...
> 	INSTALLMESSAGE_INITIALIZE     ,
> 	INSTALLMESSAGE_TERMINATE      ,
> 	INSTALLMESSAGE_SHOWDIALOG
> }
> static if(_WIN32_MSI >= 500)
> enum INSTALLMESSAGE_PERFORMANCE=15;
> static if(_WIN32_MSI >= 400)
> enum INSTALLMESSAGE_RMFILESINUSE=16;
> static if(_WIN32_MSI >= 450)
> enum
> {
> 	INSTALLMESSAGE_INSTALLSTART=17,
> 	INSTALLMESSAGE_INSTALLEND
> }

This one doesn't get the values right for the different versions. 
The other problem is functions are written as:

    void* something(INSTALLMESSAGE arg);

So I could make all the functions take an int/uint or such, but 
that is a lot of change for the header along with less 
documenting.


More information about the Digitalmars-d-learn mailing list