hi, i've got this situation i cannot explain:
first case, short version:
1 2 3 4 5 6
|
printf("%d, %d, %d", data[1], data[2], data[3]);
Nz = Nr = 1e5 ;
for(i=1;i<=Nr;i++)
for(j=1;j<=Nz;j++)
ro[i][j] = 0.0 ;
|
it prints out all values for
data and then computes
ro
second case, short version:
1 2 3 4 5 6
|
Nz = Nr = 1e5 ;
for(i=1;i<=Nr;i++)
for(j=1;j<=Nz;j++)
ro[i][j] = 0.0 ;
printf("%d, %d, %d", data[1], data[2], data[3]);
|
computes
ro and then in prints out only the first value of
data, the rest of them are zeroes
this piece of code is part of a greater one which is a CPU and memory consuming ; but the thing is... why does it behave like this ? there are 2 independent operations. Note:
data and
ro are global variables and these operations are done in
main()
My machine is a
64 bit linux and i'm using
g++, updated to day.
Are there any parameters to g++ that need to be taken into account ?