Go to main content
Oracle® Developer Studio 12.5: C User's Guide

Exit Print View

Updated: June 2017
 
 

3.1 Size and Alignment of Atomic C Types

The following table shows the atomic data types and how they are represented. Alignment (align columns) is in bytes.

Table 7  Size and alignment of atomic C types
C Type
LP64 (AMD64) size
LP64 (AMD64) align
ILP32 (i386) size
ILP32 (i386) align
LP64 (v9) size
LP64 (v9) align
ILP32 (SPARC) size
ILP32 (SPARC) align
Integral
_Atomic _Bool
1
1
1
1
1
1
1
1
_Atomic char
_Atomic signed char
1
1
1
1
1
1
1
1
_Atomic unsigned char
1
1
1
1
1
1
1
1
_Atomic short
_Atomic signed short
2
2
2
2
2
2
2
2
_Atomic unsigned short
2
2
2
2
2
2
2
2
_Atomic int
_Atomic signed int
_Atomic enum
4
4
4
4
4
4
4
4
_Atomic unsigned int
4
4
4
4
4
4
4
4
_Atomic long
_Atomic signed long
_Atomic unsigned long
8
8
4
4
8
8
4
4
_Atomic long long
_Atomic signed long long
_Atomic unsigned long long
8
8
8
8
8
8
8
8
Pointer
any-type _Atomic *
_Atomic( any-type (*) () )
8
8
4
4
8
8
4
4
Floating-Point
_Atomic float
4
4
4
4
4
4
4
4
_Atomic double
8
8
8
8
8
8
8
8
_Atomic long double
16
16
12
4
16
16
16
8
Complex
_Atomic float _Complex
8
8
8
8
8
8
8
8
_Atomic double _Complex
16
16
16
16
16
16
16
8
_Atomic long double _Complex
32
16
24
4
32
16
32
8
Imaginary
_Atomic float _Imaginary
4
4
4
4
4
4
4
4
_Atomic double _Imaginary
8
8
8
8
8
8
8
8
_Atomic long double _Imaginary
16
16
12
4
16
16
16
8
struct (selective examples)
_Atomic struct {char a[2];}
2
2
2
2
2
2
2
2
_Atomic struct {short a[2];}
4
4
4
4
4
4
4
4
_Atomic struct {int a[2];}
8
8
8
8
8
8
8
8
_Atomic struct {char a[16];}
16
16
16
16
16
16
16
8

The general alignment rule for atomic struct types is: if the size of the struct type is one of 2, 4, 8 or 16 and the alignment of the corresponding non-atomic type is smaller than the size, then the alignment of the atomic struct type is increased to match the size.

Atomic types are not permitted for bit-fields.