Learning standard integer types

To address the uncertainty of the default types provided by C and C++, both provide the standard integer types, which are accessible from the stdint.h header file. This header defines the following types:

  • int8_t, uint8_t
  • int16_t, uint16_t
  • int32_t, uint32_t
  • int64_t, uint64_t

In addition, stdint.h provides both least and fast versions of the aforementioned types, and a max type and integer pointer type, which is all out-of-scope for this book. The previous types do exactly what you would expect; they define the width of integer types with a specific number of bits. For example, an int8_t is a signed 8 bit integer. No matter what the CPU architecture, operating system, or mode is, these types are always the ...

Get Hands-On System Programming with C++ 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.