Вопрос по c++, sockets – Почему неверный сокет определен как ~ 0 в WinSock2.h (c ++)?

17

Error: User Rate Limit Exceeded

#define INVALID_SOCKET  (SOCKET)(~0)
#define SOCKET_ERROR            (-1)
Error: User Rate Limit Exceeded PlasmaHH
Error: User Rate Limit ExceededalmostError: User Rate Limit Exceeded Michael J
Error: User Rate Limit Exceeded user703016

Ваш Ответ

6   ответов
18

~0-1

~0-1

SOCKETwrong(SOCKET)(~0)~0INT_MINSOCKETINT_MAX+2, 0

-1couldUINT_MAX~0UL-1

Error: User Rate Limit Exceededwinsock2.hError: User Rate Limit ExceededIError: User Rate Limit Exceeded
Error: User Rate Limit Exceeded unj2
31

that

that

That

not

3

    unsigned   a = SOCKET_ERROR;
    long long  b = a;
    if (b != SOCKET_ERROR)
        std::cout << "????\n";

0

Error: User Rate Limit ExceedednotError: User Rate Limit Exceeded
Error: User Rate Limit Exceeded-1Error: User Rate Limit Exceeded#define INVALID_SOCKET (SOCKET)(-1);Error: User Rate Limit Exceeded
0

Error: User Rate Limit ExceededLecture notes - Chapter 5 - Data RepresentationError: User Rate Limit ExceededDoes the C++ standard requires signed integers to have exactly one sign bit?
0

INVALID_SOCKETError: User Rate Limit ExceededSOCKETError: User Rate Limit ExceededHANDLEError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded-1Error: User Rate Limit Exceeded

Похожие вопросы