分享方式:


編譯器警告 (層級 1) C4533

'instruction ' 會略過 ' variable ' 的初始化

備註

您程式中的指令變更了控制流程,因此未執行初始化變數的指令。

[啟用其他安全性檢查] 編譯器選項會將 /sdl 這個警告提升為錯誤。

範例

下列範例會產生 C4533。 若要解決此問題,請在跳躍指令之前或跳躍目標之後移動初始化。

// C4533.cpp
// compile with: /W1
#include <stdio.h>

struct A
{
   int m_data;
};

int main()
{
   if (1)
   {
      goto Label;
   }

   A a = { 100 };

   Label:   // C4533
      printf("\n%d", a.m_data);   // prints an uninitialized value
}