编译器警告(等级 1)C4293

“operator”: Shift 计数为负或过大,其行为未定义

如果 Shift 计数为负或过大,则所生成的图像的行为未定义。

示例

下面的示例生成 C4293:

// C4293.cpp
// compile with: /c /W1
unsigned __int64 combine (unsigned lo, unsigned hi) {

   return (hi << 32) | lo;   // C4293

   // try the following line instead
   // return ( (unsigned __int64)hi << 32) | lo;
}