On 11/6/2011 6:40 AM, Michel Fortin wrote:
> On 2011-11-06 04:04:22 +0000, Walter Bright <[email protected]> said:
>
>> On 11/5/2011 2:07 PM, Jonathan M Davis wrote:
>>> dmd's version identifiers are annoyingly variable (e.g. linux is camelcased,
>>> whereas Windows is Pascal-cased and OSX is all uppercase).
>>
>> What they do is follow the casing and spelling of the pre-defined macros of
>> the local C compiler.
>
> I find this statement puzzling. According to
> <http://predef.sourceforge.net/preos.html>:
>
> * There's no OSX macro on OS X, just __APPLE__ and __MACH__.
> * There's no Solaris macro on Solaris, only 'sun' and '__sun'.
> * There's no Windows/Win32/Win64 macro on Windows, there's
> __WINDOWS__/_WIN32/_WIN64.
> * There's no FreeBSD macro on FreeBSD, instead you have __FreeBSD__.
>
> Beside linux, I don't see any of the predefined version identifiers
> corresponding to the platform's standard C macros.

Based on my research:

        _WIN32          Microsoft NT, Windows 95, Windows 98, Win32s, Windows 
2000
        _WIN64          Windows for AMD64
        linux           Linux
        __APPLE__       Mac OSX
        __FreeBSD__     FreeBSD
        __OpenBSD__     OpenBSD
        __sun&&__SVR4   Solaris, OpenSolaris (yes, both macros are necessary)

Hence FreeBSD rather than freebsd or Freebsd. The underscores just looked awful :-) and are unnecessary for D since the version tags are in a separate namespace.

Had to come up with one for Solaris.

APPLE is hopelessly generic, considering Apple has produced many operating 
systems.

__WINDOWS__ is not what DMC uses. See

   http://www.digitalmars.com/ctg/predefined.html

Some people have protested that I have "trivialized" Linux by using "linux", but I am perplexed why that's ok for gcc but not for D.

And finally, there is no such thing as a "sane" version identifier scheme. For one thing, OS vendors do not pick sane names. OS/2 is not an identifier. Neither is OS X. Nor is GNU/Linux. Nor do the OS vendors pick any sane identifiers for their own systems (look at what Sun did).

Even if someone comes up with a naming scheme for D that most agree is sane, intuitive, and attractive, switching to it would again silently break a large swath of existing D code. D cannot advance by constantly breaking things.

Reply via email to