Version Identifiers for Platforms / Architectures not supported by DMD

Jacob Carlborg doob at me.com
Mon Nov 7 04:29:19 PST 2011


On 2011-11-07 11:55, Manu wrote:
> True-ish, but they're not even slightly the same from a developer
> perspective. People often make that mistake, where technologies are
> similar, but neglect the fact that you have to do fundamentally
> different things on the devices.
> They need to be distinguished. If darwin is defined, then it ALSO needs
> a OSX/iOS for disambiguation in addition.

That's correct but it also depends on what you're developing. Say if you 
develop a library for handling strings (not drawing) they would probably 
be exactly the same on Mac OS X and iOS.

> Yes, but they need to be declared standard, and listed somewhere. If
> they're not reliable, then you'll inevitably be in the same mess as
> cross platform C apps where you need a global header that parses and
> munges a huge pile of arbitrary defines into useful macros for your app.

This is a list of all predefined version identifiers: 
http://d-programming-language.org/version.html#PredefinedVersions

> For any platform/architecture, there should ALWAYS be available at least
> identifiers for PLATFORM, OS, and ARCHITECTURE.
> An identifier for TOOLCHAIN is often useful too, since different
> toolchains for the same system might be slight different, eg. console
> game dev in particular... GCC, SN, Codewarrior, proprietary compilers;
> all target exactly the same thing, but require some toolchain specific code.

What is "platform" in this case.

> Basically I think if those three (I'd argue for 4) things aren't
> present, standardised, and dependable, there will always eventually be
> the mess we all love in the top of C header files.
>
> For instance, the OSX example above, I'd suggest something like:
>   PLATFORM = darwin
>   OS = OSX/iOS
>   ARCHITECTURE = X86/PPC/ARM
>   TOOLCHAIN = [whatever]

Ok, so for linux it could be the following?

platform = linux
os = ubuntu
architecture = x86
tool chain = gcc

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list