#ifdef hell

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 29 16:55:12 PDT 2015


On Thursday, 29 October 2015 at 23:14:26 UTC, David Nadlinger 
wrote:
> On Thursday, 29 October 2015 at 23:10:38 UTC, Walter Bright 
> wrote:
>> We advise people not to use static if to do what version(x) 
>> eschews, and suggest better alternatives.
>
> Ha, I wish!
>
> In fact, you are currently arguing for people to write *more* 
> version statements over at the 
> https://github.com/D-Programming-Language/dmd/pull/5231

The idea is that you get rid of all of the &&ing and ||ing that 
tends to make #ifdefs really hard to follow and error-prone. And 
by having each version fully separate, changing one version won't 
break another.

Now, that comes at the cost of forcing you to duplicate a lot of 
code, which almost everyone other than Walter thinks is worse 
than the risks associated with merging similar versions together, 
but as far as I can tell, Walter is completely consistent in his 
arguments.

- Jonathan M Davis


More information about the Digitalmars-d mailing list