mardi 21 avril 2015

c++14 value initialization issue

Who knows wy local i_local value is zero-initialized in this example http://ift.tt/1OafBbW?

#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
}

It is variable with automatic storage duration and according to standart is should have undetermined value.

In my local computer (c++11) it is undetermined but in ideone (c++14) zeroed.

Aucun commentaire:

Enregistrer un commentaire