这是WSAStartup函数在头文件中的声明,这个声明可以不解释,不过也希望各位解释一下
#if INCL_WINSOCK_API_PROTOTYPES
__control_entrypoint(DllExport)
WINSOCK_API_LINKAGE
__checkReturn
int
WSAAPI
WSAStartup(
__in WORD wVersionRequested,
__out LPWSADATA lpWSAData
);
#endif /* INCL_WINSOCK_API_PROTOTYPES */
这是要看的,1<<8|1是什么意思啊??
WSAStartup((WORD)(1<<8|1),(LPWSADATA)&WSAData);
------解决方案--------------------------------------------------------
1<<8
------解决方案--------------------------------------------------------
1 : 位运算,先将1左移8位,然后与1做按位或运算
------解决方案--------------------------------------------------------
//C++ Operators
// Operators specify an evaluation to be performed on one of the following:
// One operand (unary operator)
// Two operands (binary operator)
// Three operands (ternary operator)
// The C++ language includes all C operators and adds several new operators.
// Table 1.1 lists the operators available in Microsoft C++.
// Operators follow a strict precedence which defines the evaluation order of
//expressions containing these operators. Operators associate with either the
//expression on their left or the expression on their right; this is called
//“associativity.” Operators in the same group have equal precedence and are
//evaluated left to right in an expression unless explicitly forced by a pair of
//parentheses, ( ).
// Table 1.1 shows the precedence and associativity of C++ operators
// (from highest to lowest precedence).
//
//Table 1.1 C++ Operator Precedence and Associativity
// The highest precedence level is at the top of the table.
//+------------------+-----------------------------------------+---------------+
//
------解决方案--------------------------------------------------------
Operator
------解决方案--------------------------------------------------------
Name or Meaning
------解决方案--------------------------------------------------------
Associativity
------解决方案--------------------------------------------------------
//+------------------+-----------------------------------------+---------------+
//
------解决方案--------------------------------------------------------
::