22.4.1 32-Bit C/C++ Compiler Macros
The compiler defines a number of macros, most with the prefix
“_MCHP_
”, which characterize the various target specific options,
the target processor and other aspects of the host environment.
_MCHP_SZINT |
32 or 64, depending on command line options to set the size of an
integer (-mint32 -mint64 ). |
_MCHP_SZLONG |
32 or 64, depending on command line options to set the size of an
integer (-mlong32 -mlong64 ). |
_MCHP_SZPTR |
32 always since all pointers are 32 bits. |
__mchp_no_float |
Defined if -mno-float specified. |
__NO_FLOAT |
Defined if -mno-float specified. |
__SOFT_FLOAT |
Defined if -mno-float not specified and the
specified device does not feature a hardware Floating-Point Unit (FPU).
Indicates that floating-point operations are supported via library
calls. |
__HARD_FLOAT |
Defined if -mno-float and
-msoft-float are not specified and the specified
device features a hardware Floating-Point Unit (FPU). Indicates that
floating-point operations utilize the FPU. |
__PIC32MX
|
Defined when a PIC32MX device is specified with the
-mprocessor option. |
__PIC32MZ |
Defined when a PIC32MZ device is specified with the
-mprocessor option. |
__PIC32_FEATURE_SET__ |
The compiler predefines a macro based on the features available for
the selected device. These macros are intended to be used when writing
code to take advantage of features available on newer devices while
maintaining compatibility with older devices. Examples:
PIC32MX795F512L would use: Examples: PIC32MZ2048ECH100 would use:
|
PIC32MX |
Defined if -ansi is not specified. |
__LANGUAGE_ASSEMBLY
|
Defined if compiling a pre-processed assembly file (.S files). |
LANGUAGE_ASSEMBLY |
Defined if compiling a pre-processed assembly file (.S files) and
-ansi is not specified. |
__LANGUAGE_C
|
Defined if compiling a C file. |
LANGUAGE_C |
Defined if compiling a C file and -ansi is not
specified. |
__LANGUAGE_C_PLUS_PLUS
|
Defined if compiling a C++ file. |
__EXCEPTIONS |
Defined if X++ exceptions are enabled. |
__GXX_RTTI |
Defined if runtime type information is enabled. |
__processor__ |
Where “processor” is the capitalized argument to the
-mprocessor option. for example,
-mprocessor=32mx12f3456 will define
__32MX12F3456__ |
__XC |
Always defined to indicate that this is a Microchip XC compiler. |
__XC32 |
Always defined to indicate this the XC32 compiler. |
__VERSION__ |
The __VERSION__ macro expands to a string constant
describing the compiler in use. Do not rely on its contents having any
particular form, but it should contain at least the release number. Use
the __XC32_VERSION macro for a numeric version
number. |
__XC32_VERSION or
|
The C compiler defines the constant __XC32_VERSION ,
giving a numeric value to the version identifier. This macro can be used
to construct applications that take advantage of new compiler features
while still remaining backward compatible with older versions. The value
is based upon the major and minor version numbers of the current
release. For example, release version 1.03 will have a
__XC32_VERSION definition of 1030. This macro can
be used, in conjunction with standard preprocessor comparison
statements, to conditionally include/exclude various code
constructs. |
__mips_dsp 1
|
The C compiler defines these constants when the selected target device supports the DSPr2 engine. |
__mips_micromips 1 |
The compiler defines these constants when we are building for the
microMIPS compressed ISA as the default using the
-mmicromips option. |
__mips_soft_float 1 |
The compiler defines this constant when we are compiling for software floating-point operations. |
See also the device-specific include files (pic32mx/include/proc/p32*.h
)
for other macros that can be used to determine the features available on the selected
device. You will find these macros near the end of the header file.