September 28, 2013
On 2013-09-28 01:44, "Luís Marques" <luis@luismarques.eu>" wrote:

> I can send a pull request with the values filled-in for Windows and OS X.

You need FreeBSD as well.

> Haha :-) I understand, my remark was lighthearted. Still, it seems a bit
> inconsistent and error prone, given the other identifiers. I mean, I'm
> all in favor of using "darwin" for OS X (more technically correct, and
> allows your code to compile in a pure Darwin environment), but if you
> changed it to "OSX" because it was more discoverable then... that's the
> kind of usability issue I'm talking about.

Yes, it is inconsistent.

> BTW, does that mean that gcc also defines capitalized "OSX", "Posix",
> etc.? (otherwise I don't understand your argument)

No, GCC defines __APPLE__ for Mac OS X and it does not define Posix.

-- 
/Jacob Carlborg
September 28, 2013
On 2013-09-28 02:28, "Luís Marques" <luis@luismarques.eu>" wrote:
> BTW, I have for more than once wondered why there was no way to specify
> more than one version identifier (is there?), like this:
>
>      version(Windows, OSX)
>      {
>          enum LC_ALL            = 0;
>          enum LC_COLLATE        = 1;
>          enum LC_CTYPE          = 2;
>          enum LC_MONETARY       = 3;
>          enum LC_NUMERIC        = 4;
>          enum LC_TIME           = 5;
>      }
>      version(OSX)
>      {
>
>          enum LC_MESSAGES       = 6;
>      }
>
> Is there a way to use version() that avoids having to repeat the equal
> declarations for both Windows and OSX?

If you really want to do this, despite what Walter has said. You can use manifest constants and static ifs:

version (OSX)
    enum OSX = true;
else
    enum OSX = false;

version (linux)
    enum linux = true;
else
    enum linux = false;

And so on

static if (linux || OSX)
{
}
else {}

-- 
/Jacob Carlborg
September 28, 2013
On 2013-09-28 03:52, Walter Bright wrote:

> If you're looking for gcc naming consistency, you'll be badly disappointed.

Same for D. It's not consistent with GCC neither is it consistent within it self.

But we have already had this discussion several times before. No point in having it again.

-- 
/Jacob Carlborg
September 28, 2013
On 2013-09-28 06:46, "Luís Marques" <luis@luismarques.eu>" wrote:

> Let's use some lateral thinking. How about a compiler warning if,
> say, a version statement does not match any defined version
> identifier but it would if a case-insensitive comparison was made?

It's possible to have user defined version identifiers:

module foo;

version (Foo)
    // when Foo
else
    // else

dmd foo.d -version=Foo

-- 
/Jacob Carlborg
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11293
https://github.com/D-Programming-Language/druntime/pull/641
1 2 3
Next ›   Last »