For Raspberry Pi with a 32-bit processor
Name | C++ | Bytes | Range |
bool | 1 | true or false | |
signed char | int8_t | 1 | -128 to 127 |
unsigned char | uint8_t | 1 | 0 to 255 |
short int | int16_t | 2 | -32768 to 32767 |
unsigned short int | uint16_t | 2 | 0 to 65535 |
int | int32_t | 4 | -2147483648 to 2147483647 |
unsigned int | uint32_t | 4 | 0 to 4294967295 |
long int | int32_t | 4 | -2147483648 to 2147483647 |
unsigned long int | uint32_t | 4 | 0 to 4294967295 |
long long | int64_t | 8 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long long | uint64_t | 8 | 0 to 18,446,744,073,709,551,615 |
float | 4 | +/- 3.4e +/- 38 (~7 digits) | |
double | 8 | +/- 1.7e +/- 308 (~15 digits) | |
long double | 8 | +/- 1.7e +/- 308 (~15 digits) | |
wchar_t | 2 or 4 | 1 wide character |
For Raspberry Pi with a 64-bit processor
Name | C++ | Bytes | Range |
bool | 1 | true or false | |
signed char | int8_t | 1 | -128 to 127 |
unsigned char | uint8_t | 1 | 0 to 255 |
short int | int16_t | 2 | -32768 to 32767 |
unsigned short int | uint16_t | 2 | 0 to 65535 |
int | int64_t | 8 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned int | uint64_t | 8 | 0 to 18,446,744,073,709,551,615 |
long int | int64_t | 8 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long int | uint64_t | 8 | 0 to 18,446,744,073,709,551,615 |
long long | int64_t | 8 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long long | uint64_t | 8 | 0 to 18,446,744,073,709,551,615 |
float | 4 | +/- 3.4e +/- 38 (~7 digits) | |
double | 8 | +/- 1.7e +/- 308 (~15 digits) | |
long double | 8 | +/- 1.7e +/- 308 (~15 digits) | |
wchar_t | 2 or 4 | 1 wide character |
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.
2 years ago
That’s why many of my long double C functions did not compile or work for I thought Raspberry Pis would support at least 80-bit floating-point numbers … Thanks so much for your two interesting tables !
4 years ago
Hi,
I have a question about the 64-bit processor. (int till unsigned long int)
How do you get xxx64_t with 4Bytes ? All the numbers are fitting to 64bit and 8Bytes.
But which information is correct?
(If I have a lag of information, maybe others have the same issue, and a short explanation under the sheet would be nice.)
4 years ago
Ooops you’re quite right, of course you don’t! That was a copy and paste typo error I think – corrected now, thanks