D alternative for C/C++ -Dfoo=42

Tobias Pankrath tobias at pankrath.net
Tue Feb 25 06:18:56 PST 2014


On Tuesday, 25 February 2014 at 13:26:20 UTC, Dejan Lekic wrote:
>>
>> I don't like it. I would prefer a CTFE-able counter part to 
>> boost::program_options that generates thouse enums from a 
>> config file.
>
> If you want a config file, you do not need -D args. You simply 
> import() it. Right?

Yep, that would be a cleaner solution since it would avoid some 
pitfalls with the current flags proposal: Should those enums be 
fully qualified? What if I put all the source files into a single 
command line (which leads to faster compilation with dmd)? May 
that override enums by accident? Should every enum be 
overwriteable or only those that have a specific UDA etc. etc. ?

And in the end you are using a build tool anyway and you'll put 
your config flags into a makefile or something that then becomes 
an ugly config file.


More information about the Digitalmars-d-learn mailing list