ISO C データ表現
この付録では、ISO C の記憶装置におけるデータ表現と、関数に引数を渡す仕組みについて説明します。C 言語以外の言語でモジュールを記述したり使用したいプログラマが、それらのモジュールに C 言語コードとのインタフェースを持たせるための手引きとして役立つかもしれません。
G.1 記憶領域の割り当て
次の表は、データ型とそれらがどのように表されるかを示しています。サイズはバイト単位です。
注 -
スタックに割り当てられるストレージ (内部 (または自動) リンケージを持つ識別子) は 2G バイト以下に制限するようにしてください。
表 100 データ型の記憶装置の割り当て
|
|
|
|
|
整数
|
|
|
|
|
_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)
|
ポインタ
|
|
|
|
|
任意の型 *
任意の型 (*) ()
|
8
|
8
|
4
|
4
|
浮動小数点
|
|
|
|
|
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)
|
複素数
|
|
|
|
|
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)
|
虚数
|
|
|
|
|
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)
|
|
不可分 C 型のサイズと整列:
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)