This documentation is archived and is not being maintained.

Compiler Warning (level 4) C4127

conditional expression is constant

The controlling expression of an if statement or while loop evaluates to a constant. The code in the body of the if statement or while loop always executes or never executes. The following sample generates C4127:

// C4127.cpp
// compile with: /W4
int main() {
   if (1 == 1) {   // C4127, constant expression