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?
The datatype size_t is unsigned integral type. It represents the size of any object in bytes and returned by sizeof operator. It is used for array indexing and counting. It can never be negative.
In C++, size_t is an unsigned integer type that is the result of the “sizeof” operator.
size_t is used to store sizes of data objects, and is guaranteed to be able to hold the size of any data object that the particular C implementation can create. This data type may be smaller (in number of bits), bigger or exactly the same as unsigned int.
size_t is a platform dependent means to represent size of objects. It is always unsigned, but the it can be an unsigned 32 bit value on 32bit platforms or 64 bit value for 64bit platforms. On iPhone SDK is an unsigned long
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With