Variable Base Types

The standard C/C++ variables consist of base types (char, short, int, and so on), which can be grouped together to form user-defined types (struct, union, bitfield, and so on). This chapter looks at base types and grouped types separately, starting with the base types.

Size and Range of Variables

Although most compilers these days use the same memory mapping of base types, this is still not always the case. Furthermore, not all programmers are always fully aware of the implications of choosing a certain base type. This section therefore takes a closer look at the size—number of bytes—that each variable type takes up and the range of values they can contain.

Determining variable type size is easily done with the C/C++ sizeof() ...

Get C++ Footprint and Performance Optimization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.