C ++ 14 value initialization problem

Who knows that the local i_local value in this example is initialized to the zero value http://ideone.com/Cqer9Z ?

#include <iostream>
using namespace std;

int main() {

    int i_local; // automatic storage duration, not static

    cout << "Value of i_local: " << i_local << endl; // (2-3) value is undetermined
}

This is a variable with automatic storage time and should have an undefined value according to the standard.

In my local computer (C ++ 11) it is not defined, but in ideone (C ++ 14) it is reset.

+4
source share
2 answers

In full, the standard says (highlighted by me):

, , , (5.18). [...] , undefined, [ ...]

undefined. 0, 50, , .

+7

Zero int, int .

, UB , , , .

+2

All Articles