2.1. Data Representation and Built-in Types

The C++ compiler manipulates built-in types in your programs. Data type representation is machine specific in C++, but Table 2.1 lists typical sizes.

Table 2.1. Typical built-in type sizes in bits
Built-in Type 16-Bit Word Size 32-Bit Word Size 64-Bit Word Size
char (signed) 8 8 8
wchar_t (signed) 16 16 16
int (signed) 16 32 32
bool 16 32 32
short (signed) 16 16 16
long (signed) 32 32 64
float (signed) 32 32 32
double (signed) 64 64 64
unsigned char 8 8 8
unsigned int 16 32 32
unsigned short 16 16 16
unsigned long 32 32 64
long double (signed) 64 128 128

Integer formats (one's complement or two's complement) and extended precision formats are machine dependent and have different representations. Built-in ...

Get Navigating C++ and Object-Oriented Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.