enum and static if

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 11 08:21:02 PDT 2015


On Wednesday, March 11, 2015 14:55:01 Namespace via Digitalmars-d-learn wrote:
> Thanks, I've hoped that 'static if' is a full replacement for #if

Walter Bright has a rather dim view of #if and friends in C/C++ given how
often he's seen them abused, which is why version and static if are more
restricted in D - in particular, it's why version won't take a boolean
expression. And while some folks get really annoyed about having to
duplicate code for different versions, he seems to be of the opinion that
that's the right way to do it and that the C/C++ way is incredibly
error-prone. Personally, I'd say that this particular use case probably
would be fine, but it would complicate how static if works, so I suspect
that he'd be against it.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list