Version Identifiers for Platforms / Architectures not supported by DMD

Alex Rønne Petersen xtzgzorex at gmail.com
Mon Nov 7 02:59:37 PST 2011


On 07-11-2011 11:55, Manu wrote:
>     Both Mac OS X and iOS builds on the same foundation.
>
>
> 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.
>
>         I've been tinkering with PSP... what about Android, PS3,
>         XBox(/360), etc...
>         Some of these platforms exist on multiple architectures... how to
>         distinguish the architecture from the platform? Standardisation
>         of arch
>         names?
>
>
>     There are version identifiers for different architectures as well,
>     e.g. X86, X86_64 and so on.
>
>
> 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.
>
> 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.
>
> 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]

I'm not sure I see the idea in having a platform value separate from an 
OS value. Otherwise I agree; OS, architecture, and toolchain should 
always be identifiable.

- Alex


More information about the Digitalmars-d mailing list