C header file: tagged enumerations

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


On Wednesday, 27 April 2016 at 16:04:13 UTC, Steven Schveighoffer 
wrote:
> BTW, this enumeration looks terrible. I would flag this as 
> blocking if it were a code review, even in C++.
>
> -Steve

Yeah, I didn't even consider that different versions have 
different enum values; that is going to be a really good way to 
break backwards compatibility.

Hmm, I wonder if I can make use of UDA and a mixin something like

enum tagINSTALLMESSAGE
{
// 12 others ...
	INSTALLMESSAGE_INITIALIZE     ,
	INSTALLMESSAGE_TERMINATE      ,
	INSTALLMESSAGE_SHOWDIALOG     ,
[greaterThan(500)]
	INSTALLMESSAGE_PERFORMANCE    ,
[greaterThan(400)]
	INSTALLMESSAGE_RMFILESINUSE   ,
[greaterThan(450)]
	INSTALLMESSAGE_INSTALLSTART   ,
[greaterThan(450)]
	INSTALLMESSAGE_INSTALLEND     ,
}

mixin taggedEnum!tagINSTALLMESSAGE


More information about the Digitalmars-d-learn mailing list