Skip to content

Latest commit

 

History

History
104 lines (74 loc) · 2.01 KB

File metadata and controls

104 lines (74 loc) · 2.01 KB

Architectures

Source

src/architectures.h

Contents

__arch__

The type of __arch__

macro

Description of __arch__

Represents the processor architecture type. If the judgment fails, the value is set to '__arch_unknown__'.

Value of __arch__

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__

Example of __arch__

#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;
}

__arch_name__

Type of __arch_name__

macro

Description of __arch_name__

Architecture name, like uname -m. If the judgment fails, the value is "Unknown".

Example of __arch_name__

#include <cppp/cppp-platform.h>

#include <stdio.h>

int main()
{
    printf("Arch name: %s\n", __arch_name__);
}

__POINTER_WIDTH__

Type of __POINTER_WIDTH__

macro

Description of __POINTER_WIDTH__

This represents the pointer length. The value is generally 32 or 64.

Example of __POINTER_WIDTH__

#include <cppp/cppp-platform.h>
#include <stdio.h>
int main()
{
    printf("Pointer width: %ld\n", __POINTER_WIDTH__);
}