Back to top

XS1 Data Types

Version: X3438A Date: November 14, 2013Download PDF
VersionReleased
X3438ANov 14, 2013 download view

The size and alignment of C and XC’s data types are not specified by the language. This allows the size of int to be set to the natural word size of the target device, ensuring the fastest possible performance for many computations. It also allows the alignment to be set wide enough to enable efficient memory loads and stores. the table below represents the size and alignment of the data types specified by thexCORE Application Binary Interface, which provides a standard interface for linking objects compiled from both C and XC.

In addition:

  • The char type is by default unsigned.
  • The types char, short and int may be specified in a bit-field’s declaration.
  • A zero-width bit-field forces padding until the next bit-offset aligned with the bit-field’s declared type.
  • The notional transfer type of a port is unsigned int (32 bits).
  • The notional counter type of a port is unsigned short (16 bits).
  • The notional counter type of a timer is unsigned int (32 bits).
Data TypeSizeAlignSupportedMeaning
 (bits)(bits)XCC 

char88YYCharacter type
short1616YYShort integer
int3232YYNative integer
long3232NYLong integer
long long6432NYLong long integer
float3232NY32-bit IEEE float
double6432NY64-bit IEEE float
long double6432NY64-bit IEEE float
void *3232NYData pointer
port3232YNPort
timer3232YNTimer
chanend3232YNChannel end