As title: is size_t always unsigned, i.e. for size_t x, is x always >= 0 ?
According to the standard it is unsigned, however I recall that some older implementations used a signed type for the typedef.
From an older GCC doc:
There is a potential problem with the size_t type and versions of GCC prior to release 2.4. ANSI C requires that
size_talways be an unsigned type. For compatibility with existing systems' header files, GCC definessize_tinstddef.hto be whatever type the system'ssys/types.hdefines it to be. Most Unix systems that definesize_tinsys/types.h, define it to be a signed type. Some code in the library depends onsize_tbeing an unsigned type, and will not work correctly if it is signed
I'm not sure how important it would be to guard against that. My code assumes it's unsigned.