C header file: tagged enumerations

BLM768 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 27 10:44:27 PDT 2016


On Tuesday, 26 April 2016 at 23:40:24 UTC, Adam D. Ruppe wrote:
> D doesn't handle this C pattern well... you basically have to 
> rewrite the whole thing for each version.

Or you can use the technique that's used in llvm-d: build the 
enumeration from a string mixin which is generated from a table. 
It's not necessarily the most elegant solution, but it can 
eliminate some code duplication.


More information about the Digitalmars-d-learn mailing list