SIZE_MAX is the upper bound of the values representable by size_t. Because size_t is unsigned, its range begins at 0 and ends at SIZE_MAX. section 4.0
A platform-independent limit
Include stdint.h and use SIZE_MAX rather than hard-coding a numerical limit. Depending on the platform, the bound may be 65535, 4294967295, or 18446744073709551615. section 4.0
Keep these relationships in view:
- Treat values from 0 through SIZE_MAX as representable size_t values. section 4.0
- Recognize that arithmetic exceeding SIZE_MAX produces overflow, even though unsigned arithmetic remains well defined. section 4.1.1
Table 4.1. Value operators The Form column gives the syntactic form of the operation, where @ represents the operator and a and possibly b denote values that serve as operands. For arithmetic and bit operations, the type of the result is a type that reconciles the types of a and b. For some of the operators, the Nick column gives an alternative form of the operator, or lists a combination of operators that has special meaning. Most of the operators and terms will be discussed later. (view table figure)
Use the value-operator table to place SIZE_MAX in expressions involving arithmetic, comparison, and other operators. section 4.0
