PATH  Documentation > Mac OS X > Developer Tools > The GNU C Preprocessor


Previous | Contents | Next

Platform-Dependant Predefined Macros

The C preprocessor normally has several predefined macros that vary between machines because their purpose is to indicate what type of system and machine is in use. This section lists some that are useful on Mac OS X computers.

__APPLE__

__APPLE__

This macro is defined on any Apple platform, including Mac OS X.

Use the __APPLE__ macro instead of the following, which may not be supported in future versions: NeXT , __NeXT , __NeXT__ , and _NEXT_SOURCE .

__APPLE_CC__

__APPLE_CC__

This macro is set to an integer that represents the version number of the compiler. This lets you distinguish, for example, between compilers based on the same version of GCC, but with different bug fixes or features. Larger values denote later compilers.

Use the __APPLE_CC__ macro instead of the following, which may not be supported in future versions: NX_COMPILER_RELEASE_3_0 , NX_COMPILER_RELEASE_3_1 , NX_COMPILER_RELEASE_3_2 , NX_COMPILER_RELEASE_3_3 , NX_CURRENT_COMPILER_RELEASE , NS_TARGET , NS_TARGET_MAJOR , and NS_TARGET_MINOR .

__hppa__

__hppa__

This macro is defined when you're compiling code to run on a HPPA-based workstastion .

__i386__

__i386__

This macro is defined when you're compiling code to run on any chip in the Intel 80x86 family, including all versions of the Pentium.

Use the __i386__ macro instead of i386 and __i386 , which may not be supported in future versions.

__ppc__

__ppc__

This macro is defined when you're compiling code to run on any chip in PowerPC family.

Use the __ppc__ macro instead of ppc and __ppc , which may not be supported in future versions.

__sparc__

__sparc__

This macro is defined when you're compiling code to run on a SPARC-based workstastion .

__unix__

__unix__

This macro is defined when you're compiling code to run on a UNIX system. It is predefined if you are compiling code to run on a Solaris and HP-UX system. Note that it will not be defined in future versions of Mac OS X. To test for a Mac OS X system, use __APPLE__ .


The GNU C Preprocessor

Previous | Contents | Next