The status of C ::send and ::recv is read as an int, but if the buffer size is larger than that, it will deduce there is an error when there is not. In pseudo-code:
char *buf, long long int size;
int status = ::send(buf, size);
if (status < 0)
report_error();
However, if size is larger than MAX_INT and this is successfully returned by ::send, status will be smaller than zero through casting.
I think its reasonable to assume that the input size should be an int, or that ::send will always return less than MAX_INT, but maybe an explicit comment about these assumptions would be good.
The status of C ::send and ::recv is read as an int, but if the buffer size is larger than that, it will deduce there is an error when there is not. In pseudo-code:
However, if
sizeis larger thanMAX_INTand this is successfully returned by::send,statuswill be smaller than zero through casting.I think its reasonable to assume that the input
sizeshould be an int, or that::sendwill always return less than MAX_INT, but maybe an explicit comment about these assumptions would be good.