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

Cherry cherry at dream.land
Tue Feb 25 05:39:01 PST 2014


> I would have taken that approach for my current needs, but I do 
> not see any way to have a fallback if the config file does not 
> exist. I mean mixin import would just fail to compile if the 
> configuration file is not present. I need an option to live 
> with default values if the configuration file is not there. 
> Something like "static if(fileExists!"config.d") 
> mixin(import("config.d")) else ...".


For now maybe I could keep an empty/default config.d somewhere in 
the library source path. And I could use that with multiple -J 
options. This way dmd configuration from the default path unless 
it finds the config file in the user path.

That should be good enough for me. But I believe this could be 
made more friendly.

Regards
- Cherry


More information about the Digitalmars-d-learn mailing list