[Wien] P21/c ( n╟14 ) space group

B. Yanchitsky yan at im.imag.kiev.ua
Sat Dec 13 16:40:46 CET 2003


> I do not if it is related, but compiling sgroup.c I get the following warnings:
> 
> sgroup.c(711): warning #175: subscript out of range
>         rop[0][0]=0.; rop[0][1]=1./2; rop[0][2]=1./3; rop[0][3]=2./3;
>                                                       ^
> 
> sgroup.c(713): warning #175: subscript out of range
>         rop[0][0]=0.; rop[0][1]=1./4; rop[0][2]=1./2; rop[0][3]=3./4;
>                                                       ^
> 
> looking in sgroup.c, the variable rop is defined rop[48][3] which in C means that
> the second index should go between 0 and 2.
> J.

You have a friendly compiler, and the warning is for human, not a complier 
problem. 
Here the rop[][] array is used only as a sequence of floating numbers,
and actually there are no problems for compiler to interpret these constructions, because C arrays are stored by rows (the
Fortran convention is to store columns). 
Sometimes similar tricks are used to avoid extra typing, for example to nullify
the 2 dimensional array rop[48][3] one might do this by 2 loops 
rop[i][j]=0, 0<=i<48, 0<=j<3, another and more economical way is single loop
rop[0][j]=0, 0<=j<48*3. GNU C compiler does not produce any warnings on such
construction even if -Wall flag was specified.

Regards,
Bogdan Yanchitsky



More information about the Wien mailing list