Good examples of version() algebra in real code

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon May 22 08:49:54 UTC 2023


On 22/05/2023 8:21 PM, Walter Bright wrote:
> The static assert is there because a very common failure of #ifdef hell 
> is to have defaults that botch things up when a new version is added.

If you want to be principled about it, one way to consider it is that 
not having an else branch (even if empty) should be an error. Because 
you clearly didn't think about the multiplicative issues of the versions.

Regardless, or'ing isn't the issue, its when you and versions that you 
get an explosion of multiplicative issues.

An option could be to use comma instead of ``||`` to handle or'ing. That 
way people won't be so tempted to "just extend it" to other operators 
like and.


More information about the Digitalmars-d mailing list