is size_t always unsigned?

Yes. It’s usually defined as something like the following (on 32-bit systems):

typedef unsigned int size_t;


C++ Standard Section 18.1 defines size_t is in <cstddef> which is described in C Standard as <stddef.h>.
C Standard Section 4.1.5 defines size_t as an unsigned integral type of the result of the sizeof operator

Leave a Comment