#define DARWIN set by Xcode?

  • On Nov 16, 2006, at 17:31 , Ivan Cavero Belaunde wrote:

    > #ifndef SOLARIS
    > #include <stdint.h>
    > typedef uint8_t uchar_t;
    > #endif

    What's the proper #define set by Xcode to indicate a build is
    occurring on Darwin/Mac OS X?

    TIA,

    --
    Rick
  • On Nov 16, 2006, at 9:33 PM, Rick Mann wrote:

    > What's the proper #define set by Xcode to indicate a build is
    > occurring on Darwin/Mac OS X?

    $ gcc -dM -E -x c - <<<''|grep -i apple
    #define __APPLE_CC__ 5363
    #define __APPLE__ 1
    #define __VERSION__ "4.0.1 (Apple Computer, Inc. build 5363)"

    --
    Steve Checkoway
  • On Nov 17, 2006, at 3:20 PM, Steve Checkoway wrote:

    >
    > On Nov 16, 2006, at 9:33 PM, Rick Mann wrote:
    >
    >> What's the proper #define set by Xcode to indicate a build is
    >> occurring on Darwin/Mac OS X?
    >
    > $ gcc -dM -E -x c - <<<''|grep -i apple
    > #define __APPLE_CC__ 5363
    > #define __APPLE__ 1
    > #define __VERSION__ "4.0.1 (Apple Computer, Inc. build 5363)"

    Well, it is probably best to roll your own define, if you can't, many
    people seem to use:
    #if defined(__APPLE__) && defined(__MACH__)

    __APPLE__ is defined for builds on classic too, so may not limit the
    conditional enough. __APPLE_CC__ is only defined for gcc on darwin,
    someone may be using a different compiler.

    Peter
  • At 9:33 PM -0800 11/16/06, Rick Mann wrote:
    > On Nov 16, 2006, at 17:31 , Ivan Cavero Belaunde wrote:
    >
    >> #ifndef SOLARIS
    >> #include <stdint.h>
    >> typedef uint8_t uchar_t;
    >> #endif
    >
    > What's the proper #define set by Xcode to indicate a build is
    > occurring on Darwin/Mac OS X?

    The test in <CarbonCore/ConditionalMacros.h> is:

    #if defined(__GNUC__) && (defined(__APPLE_CPP__) ||
    defined(__APPLE_CC__) || defined(__NEXT_CPP__) ||
    defined(__MACOS_CLASSIC__))

    Also, look at </usr/include/AvailabilityMacros.h> and see TechNote 2064.

    -Steve
  • On Nov 19, 2006, at 06:46 , Steve Sisak wrote:

    > The test in <CarbonCore/ConditionalMacros.h> is:
    >
    > #if defined(__GNUC__) && (defined(__APPLE_CPP__) || defined
    > (__APPLE_CC__) || defined(__NEXT_CPP__) || defined(__MACOS_CLASSIC__))
    >
    > Also, look at </usr/include/AvailabilityMacros.h> and see TechNote
    > 2064.

    Thanks! Checking ConditionalMacros was a good idea.

    --
    Rick
previous month november 2006 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Go to today