Objective-c – What kind of data is size_t holding


In a code-snippet I have seen this:

size_t w = CGImageGetWidth(inImage);

The docs don't give me any useful info about "size_t". Does anyone know what this is?

Best Solution

From here:

Unsigned integral type

size_t corresponds to the integral data type returned by the language operator sizeof and is defined in the header file (among others) as an unsigned integral type.

In <cstring>, it is used as the type of the parameter num in the functions memchr, memcmp, memcpy, memmove, memset, strncat, strncmp, strncpy and strxfrm, which in all cases it is used to specify the maximum number of bytes or characters the function has to affect.

It is also used as the return type for strcspn, strlen, strspn and strxfrm to return sizes and lengths.