Ch2: Basics
Overview
This chapter covers the basic building blocks of C++: data types, literals, initialization, assignment, operators, and more.
Contents
- Ch2.1: Hello World
- Ch2.2: Data Types
- Ch2.3: Literals
- Ch2.4: Initialization
- Ch2.5: Assignment
- Ch2.6: Operators
- Ch2.7: sizeof
- Ch2.8: const
- Ch2.9: Reference
- Ch2.10: auto
- Ch2.11: decltype
- Ch2.12: decltype(auto)
- Ch2.13: Casting
- Ch2.14: a + b
- Ch2.15: limits
- Ch2.16: enum class
- Ch2.17: bit
- Ch2.18: endian
- Ch2.19: using and typedef
- Ch2.20: ::std::byte
- Ch2.21: struct
Key Takeaways
- C++ has exact, least, fast and traditional integer types; choose the family that states your intent.
- Initialization is not assignment; brace initialization is the safe default.
- References,
const,auto,decltype, casts andenum classare the vocabulary used by every later chapter. - Use
::std::bytefor bytes and the fixed-width types when the width matters.