O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required