On Fri, 14 Mar 2014 05:58:28 -0400, Regan Heath <re...@netmail.co.nz> wrote:

On Fri, 14 Mar 2014 08:51:05 -0000, 1100110 <0b1100...@gmail.com> wrote:

     version (X86 || X86_64 || PPC || PPC64 || ARM || AArch64)
     {
         enum RTLD_LAZY = 0x00001;
         enum RTLD_NOW = 0x00002;
         enum RTLD_GLOBAL = 0x00100;
         enum RTLD_LOCAL = 0x00000;
     }
     else version (MIPS32)
     {
         enum RTLD_LAZY = 0x0001;
         enum RTLD_NOW = 0x0002;
         enum RTLD_GLOBAL = 0x0004;
         enum RTLD_LOCAL = 0;
     }

Walter's point, I believe, is that you should define a meaningful version identifier for each specific case, and that this is "better" because then you're less concerned about where it's supported and more concerned with what it is which is/isn't supported.

Maintenance is very slightly better too, IMO, because you add/remove/alter a complete line rather than editing a set of || && etc which can in some cases be a little confusing. Basically, the chance of an error is very slightly lower.

For example, either this:

version(X86) version = MeaningfulVersion
version(X86_64) version = MeaningfulVersion
version(PPC) version = MeaningfulVersion
version(PPC64) version = MeaningfulVersion
version(ARM) version = MeaningfulVersion
version(AArch64) version = MeaningfulVersion

version(MeaningfulVersion)
{
}
else version (MIPS32)
{
}

or this:

version (X86) version = MeaningfulVersion
version (X86_64) version = MeaningfulVersion
version (PPC) version = MeaningfulVersion
version (PPC64) version = MeaningfulVersion
version (ARM) version = MeaningfulVersion
version (AArch64) version = MeaningfulVersion

version (MIPS32) version = OtherMeaningfulVersion

version (MeaningfulVersion)
{
}
else version (OtherMeaningfulVersion)
{
}

Regan

I think the point we are trying to make is, what if MeaningfulVersion does not exist? That is, how do you attribute a name to those flags?

Then it becomes a "where's waldo" to see if your particular platform defines the arbitrary name you had to choose.

There's not always an easy to define symbol for everything.

BTW, && does not present the same problem, because there isn't much difference between:

version(x && y)
version(x) version(y)

But there is a huge difference between

version(x || y)

version(x) version = somearbitrarysymbol;
version(y) version = somearbitrarysymbol;
version(somearbitrarysymbol)

-Steve

Reply via email to