ISO C Data Representations
This appendix describes how ISO C represents data in storage and the
mechanisms for passing arguments to functions. It can serve as a guide to
programmers who want to write or use modules in languages other than C and
have those modules interface with C code.
G.1 Storage Allocation
The following
tables show the data types and how they are represented. Sizes are in bytes.
Note -
Storage allocated
on the stack (identifiers with internal, or automatic, linkage) should be limited to 2 gigabytes or less.
Table 100 Storage Allocation for Data Types
|
|
|
|
|
Integer
|
|
|
|
|
_Bool
char
signed char
unsigned char
|
1
|
1
|
1
|
1
|
short
signed short
unsigned short
|
2
|
2
|
2
|
2
|
int
signed int
unsigned int
enum
|
4
|
4
|
4
|
4
|
long
signed long
unsigned long
|
8
|
8
|
4
|
4
|
long long
signed long long
unsigned long long
|
8
|
8
|
8
|
4 (x86) / 8 (SPARC)
|
Pointer
|
|
|
|
|
any-type *
any-type
(*) ()
|
8
|
8
|
4
|
4
|
Floating Point
|
|
|
|
|
float
double
long double
|
4
8
16
|
4
8
16
|
4
8
12 (x86) / 16 (SPARC)
|
4
4 (x86) / 8 (SPARC)
4 (x86) / 8 (SPARC)
|
Complex
|
|
|
|
|
float _Complex
double _Complex
long double _Complex
|
8
16
32
|
4
8
16
|
8
16
24 (x86) / 32 (SPARC)
|
4
4 (x86) / 8 (SPARC)
4 (x86) / 8 (SPARC)
|
Imaginary
|
|
|
|
|
float _Imaginary
double _Imaginary
long double _Imaginary
|
4
8
16
|
4
8
16
|
4
8
12 (x86) / 16 (SPARC)
|
4
4 (x86) / 8 (SPARC)
4 (x86) / 8 (SPARC)
|
|
Size and alignment of atomic C types:
Where T is any of the above types, and struct or union types
size : sizeof(_Atomic(T)) is equal to sizeof(T)
alignment : if size is 1,2,4,8,16 then alignment is equal to the size,
otherwise alignof(_Atomic(T)) is equal to alignof(T)