VC++ 2010 Express warning C4700 - Problem



  • Hallo,
    bin bei dem folgenden Code auf das Problem gestoßen, dass der Compiler in zwei äquivalenten Source-Code-Varianten, die auch teilweise zu identischem generierten Code führen (z. B. bei Release mit Optimization /O2), nur in einem Fall eine Warnung generiert.

    // BUG.cpp : Defines the entry point for the console application.
    //
    #include "stdafx.h"
    
    int _tmain(/*int argc, _TCHAR* argv[]*/)
    {
       int x;
    #if 1
       x = x + x | 1;      // no warning
    #else
       x = x + x;          // warning C4700: uninitialized local variable 'x' used
       x |= 1;
    #endif
       return x;
    }
    

    Kann jemand bestätigen, dass hier ein Compiler-Bug vorliegt?



  • Du kannst sowas hier melden:
    http://connect.microsoft.com/VisualStudio


Anmelden zum Antworten