Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I read about int vs size_t vs ssize_t , and I understand that int and ssize_t is signed while size_t is unsigned.
Why memcmp return int and no return ssize_t like recv return ssize_t?
memcmp
recv
Anint足以容纳 的返回值memcmp。
int
如果两个给定的内存区域相等,则该memcmp函数返回 0,如果第一个区域比较小,则返回小于 0 的值,如果第一个区域比较多,则返回大于 0 的值。
Assize_t可能大于 an int(并且在大多数实现中会更大),并且 anint通常是“自然”字长,因此使用较大的字号没有任何好处。
ssize_t