少しソケット関連のヘッダを見てて、思った事。
/*
* Definitions related to sockets: types, address families, options,
* taken from the BSD file sys/socket.h.
*/
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
::connect()等の戻り値はSOCKET型です。つまり unsigned int です。
つまり、、、-1と~0って同じなんじゃないかと思った訳ですが、表記が違う。
何か意図しているのか、自分の知識が足りないのか。
/*
* Definitions related to sockets: types, address families, options,
* taken from the BSD file sys/socket.h.
*/
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
::connect()等の戻り値はSOCKET型です。つまり unsigned int です。
つまり、、、-1と~0って同じなんじゃないかと思った訳ですが、表記が違う。
何か意図しているのか、自分の知識が足りないのか。
コメント