I am trying to test zero initialization on virtual machine with g++ options -std=c++98, -std=c++03, -std=c++11
Unfortunately there are not so many garbage values and I see zeros in place that they shouldn't be.
How to force some random values so I can test this?
#include <iostream>
#include <string>
using namespace std;
class A
{
public:
int a;
};
class B
{
public:
B(){}
int x;
};
int main()
{
{
int tab[50000] = {0};
}
A a;
A* aa = new A;
B b;
B* bb = new B;
cout << a.a << endl;
cout << aa->a << endl;
cout << b.x << endl;
cout << bb->x << endl;
return 0;
}