Am Wed, 6 Apr 2016 17:42:30 -0700 schrieb Walter Bright <newshou...@digitalmars.com>:
> On 4/6/2016 5:36 AM, Manu via Digitalmars-d wrote: > > But at very least, the important detail is that the version ID's are > > standardised and shared among all compilers. > > It's a reasonable suggestion; some points: > > 1. This has been characterized as a blocker, it is not, as it does > not impede writing code that takes advantage of various SIMD code > generation at compile time. > > 2. I'm not sure these global settings are the best approach, > especially if one is writing applications that dynamically adjusts > based on the CPU the user is running on. The main trouble comes about > when different modules are compiled with different settings. What > happens with template code generation, when the templates are pulled > from different modules? What happens when COMDAT functions are > generated? (The linker picks one arbitrarily and discards the > others.) Which settings wind up in the executable will be not easily > predictable. > That's my #1 argument why '-version' is dangerous and 'static if' is better ;-) If you've got a version() block in a template and compile two modules using the same template with different -version flags you'll have exactly that problem. Have an enum myFlag = x; in a config module + static if => problem solved. The problem isn't having global settings, the problem is having to manually specify the same global setting for every source file.