编译器警告(等级 3)C4414

“function”:短跳转到转换为接近的函数

短跳转生成压缩指令,该指令分支到来自指令的有限范围内的地址。 该指令包含一个短偏移量,该偏移量表示跳转和目标地址之间的距离,即函数定义。 在链接过程中,函数可能会被移动或受到链接时优化的影响,从而导致该函数被移出从短偏移量可到达的范围。 编译器必须为跳转生成一个特殊记录,这要求 jmp 指令为 NEAR 或 FAR。 编译器进行了转换。

例如,下面的代码生成 C4414:

// C4414.cpp
// compile with: /W3 /c
// processor: x86
int DoParityEven();
int DoParityOdd();
unsigned char global;
int __declspec(naked) DoParityEither()
{
   __asm
   {
      test global,0
      jpe SHORT DoParityEven  // C4414
      jmp SHORT DoParityOdd   // C4414
   }
}