F
Francis Moreau
Hello,
I usually use 'unsigned int' type for variables which hold the length
of a buffer.
However, someone suggests me to use 'size_t'.
So I took a look to the C99 spec and see what it tells about size_t:
and it's the type of the retuned value by sizeof() (6.5.3.4 p4) and
its max value is 65535 (7.18.3 p2).
size_t doesn't seem to be the good type to use when the variable of
that type describes the number of elements of a buffer whose type is
not 'char' and if the buffer size is less than 65535 bytes.
Is that correct ?
Thanks
I usually use 'unsigned int' type for variables which hold the length
of a buffer.
However, someone suggests me to use 'size_t'.
So I took a look to the C99 spec and see what it tells about size_t:
and it's the type of the retuned value by sizeof() (6.5.3.4 p4) and
its max value is 65535 (7.18.3 p2).
size_t doesn't seem to be the good type to use when the variable of
that type describes the number of elements of a buffer whose type is
not 'char' and if the buffer size is less than 65535 bytes.
Is that correct ?
Thanks