I found some C++ code that does something like this:
struct Test
{
int a[128];
char b[768];
};
int main()
{
Test test;
for( int i = 0; i < 200; ++i)
test.a[i] = 1;
return 0;
}
I realize it's wrong. But, I want to know what the effect will be? On GCC 4.3.4, the Test::b array is untouched. Is that guaranteed? What is happening here?
Is it the same effect for reading? e.g.
int main()
{
Test test;
for( int i = 0; i < 200; ++i)
int z = test.a[i];
return 0;
}