macro
Represents the processor architecture type. If the judgment fails, the value is set to '__arch_unknown__'.
| Architecture | Macro |
|---|---|
| Alpha | __arch_alpha__ |
| x86 | __arch_x86__ |
| ARM | __arch_arm__ |
| Blackfin | __arch_blackfin__ |
| Convex | __arch_convex__ |
| Epiphany | __arch_epiphany__ |
| HP/PA RISC | __arch_hppa__ |
| Itanium | __arch_itanium__ |
| Motorola8k | __arch_motorola68k__ |
| MIPS | __arch_mips__0 |
| PowerPC | __arch_ppc__1 |
| Pyramid810 | __arch_pyramid9810__2 |
| RS/6000 | __arch_rs6000__3 |
| SPARC | __arch_sparc__4 |
| SuperH | __arch_superh__5 |
| SystemZ | __arch_systemz__6 |
| TMS320 | __arch_tms320__7 |
| TMS470 | __arch_tms470__8 |
| Unknown architecture | __arch_unknown__ |
#include <cppp/cppp-platform.h>
#if (__arch__ == __arch_x86__)
#pragma message "Build in x86."
#elif (__arch__ == __arch_arm__)
#pragma message "Build in arm."
#elif
#pragma message "Build in other."
#endif
int main()
{
return 0;
}macro
Architecture name, like uname -m. If the judgment fails, the value is "Unknown".
#include <cppp/cppp-platform.h>
#include <stdio.h>
int main()
{
printf("Arch name: %s\n", __arch_name__);
}macro
This represents the pointer length. The value is generally 32 or 64.
#include <cppp/cppp-platform.h>
#include <stdio.h>
int main()
{
printf("Pointer width: %ld\n", __POINTER_WIDTH__);
}