我正在了解 Winsock 并正在查看页面中的代码: Winsock 教程 1。
程序中有一行包含运算符 =*。谁能告诉我这是什么?我知道 a *= b 等价于 a = a * b。我在stackoverflow上读到=+是+=的过时形式。所以我尝试交换 * 和 = 使其成为 *=,但编译器给了我一个错误。如果有人告诉我这行代码的含义,我将不胜感激:
SockAddr.sin_addr.s_addr=*((unsigned long*)host->h_addr);
我正在了解 Winsock 并正在查看页面中的代码: Winsock 教程 1。
程序中有一行包含运算符 =*。谁能告诉我这是什么?我知道 a *= b 等价于 a = a * b。我在stackoverflow上读到=+是+=的过时形式。所以我尝试交换 * 和 = 使其成为 *=,但编译器给了我一个错误。如果有人告诉我这行代码的含义,我将不胜感激:
SockAddr.sin_addr.s_addr=*((unsigned long*)host->h_addr);
Operator =*
existed in nascent versions of C language (as the original form of *=
operator).
In C++ there's no such operator. =*
is nothing else than =
(assignment operator) followed by unary *
(dereference operator). You can look up the meaning of =
and unary *
in your favorite C++ book.