在ARM C编译环境下
Type | Size in bits | Natural alignment in bytes | Range of values |
---|---|---|---|
char | 8 | 1 (byte-aligned) | 0 to 255 (unsigned) by default. –128 to 127 (signed) when compiled with --signed_chars . |
signed char | 8 | 1 (byte-aligned) | –128 to 127 |
unsigned char | 8 | 1 (byte-aligned) | 0 to 255 |
(signed) short | 16 | 2 (halfword-aligned) | –32,768 to 32,767 |
unsigned short | 16 | 2 (halfword-aligned) | 0 to 65,535 |
(signed) int | 32 | 4 (word-aligned) | –2,147,483,648 to 2,147,483,647 |
unsigned int | 32 | 4 (word-aligned) | 0 to 4,294,967,295 |
(signed) long | 32 | 4 (word-aligned) | –2,147,483,648 to 2,147,483,647 |
unsigned long | 32 | 4 (word-aligned) | 0 to 4,294,967,295 |
(signed) long long | 64 | 8 (doubleword-aligned) | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long long | 64 | 8 (doubleword-aligned) | 0 to 18,446,744,073,709,551,615 |
float | 32 | 4 (word-aligned) | 1.175494351e-38 to 3.40282347e+38 (normalized values) |
double | 64 | 8 (doubleword-aligned) | 2.22507385850720138e-308 to 1.79769313486231571e+308 (normalized values) |
long double | 64 | 8 (doubleword-aligned) | 2.22507385850720138e-308 to 1.79769313486231571e+308 (normalized values) |
wchar_t | 16 32 | 2 (halfword-aligned) 4 (word-aligned) | 0 to 65,535 by default. 0 to 4,294,967,295 when compiled with --wchar32 . |
All pointers | 32 | 4 (word-aligned) | Not applicable. |
bool (C++ only) | 8 | 1 (byte-aligned) | false or true |
_Bool (C onlya) | 8 | 1 (byte-aligned) | false or true |
在51 C编译环境下
Data Types | Bits | Bytes | Value Range |
---|---|---|---|
bit | 1 | 0 to 1 | |
signed char | 8 | 1 | -128 — +127 |
unsigned char | 8 | 1 | 0 — 255 |
enum | 8 / 16 | 1 or 2 | -128 — +127 or -32768 — +32767 |
signed short int | 16 | 2 | -32768 — +32767 |
unsigned short int | 16 | 2 | 0 — 65535 |
signed int | 16 | 2 | -32768 — +32767 |
unsigned int | 16 | 2 | 0 — 65535 |
signed long int | 32 | 4 | -2147483648 — +2147483647 |
unsigned long int | 32 | 4 | 0 — 4294967295 |
float | 32 | 4 | ±1.175494E-38 — ±3.402823E+38 |
double | 32 | 4 | ±1.175494E-38 — ±3.402823E+38 |
sbit | 1 | 0 or 1 | |
sfr | 8 | 1 | 0 — 255 |
sfr16 | 16 | 2 | 0 — 65535 |