should use size_t or ssize_t

The Solution to should use size_t or ssize_t is

ssize_t is used for functions whose return value could either be a valid size, or a negative value to indicate an error. It is guaranteed to be able to store values at least in the range [-1, SSIZE_MAX] (SSIZE_MAX is system-dependent).

So you should use size_t whenever you mean to return a size in bytes, and ssize_t whenever you would return either a size in bytes or a (negative) error value.


~ Answered on 2013-04-01 07:50:43

Most Viewed Questions: