Size_t
size_t is an unsigned integer type in C and C++ used to represent object sizes and related counts.
Modern C
size_t is an unsigned integer type provided by the C standard library for representing object sizes and related counts.
- How it is used
- Uses size_t to express object sizes, cardinalities, and related counts with semantic type information.
- How deep it goes
- Explains size_t’s semantic classification and +, -, and * rules, but defers detailed overflow handling.
- Examples
- Demonstrates grouped expressions, unary operators, and values 45 and 7 producing 76 and 31.
- What you can do after
- Evaluate/understand size_t expressions and recognize when unsigned results are representable or overflow.
100 C++ Mistakes and How to Avoid Them
size_t is an unsigned integer type capable of representing the size of any object in C++.
- How it is used
- Represents object and container sizes while illustrating a boundary where automatic type deduction becomes unsafe.
- How deep it goes
- Defines its size guarantee and explains unsigned wraparound in reverse loops, stopping short of broader implementation details.
- Examples
- Uses a vector reverse-index loop whose unsigned counter wraps after reaching zero.
- What you can do after
- Diagnose reverse-loop crashes caused by unsigned wraparound and choose int when a negative loop condition is required.
Read how 100 C++ Mistakes and How to Avoid Them explains size_t →
Related concepts
- SIZE_MAXconfigured by · SIZE_MAX is a C standard-library macro that expands to the maximum value representable by size_t.
- modulo arithmeticimplements · Modulo arithmetic is arithmetic in which values are identified as equivalent when they differ by a multiple of a fixed modulus.
- unsigned integerkind of · An unsigned integer is an integer type or representation whose values are nonnegative, with its representable range determined by its bit width and applicable rules.
- numerical overflowcontrasts with · Numerical overflow is the condition in which an arithmetic result falls outside the range representable by its numeric type or format.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

