From: Ethan A M. <merritt@u.washington.edu> - 2006-07-08 21:19:09
|
On Saturday 08 July 2006 02:02 pm, Hans-Bernhard Br=C3=B6ker wrote: >=20 > So, summing it up: initializing, even to the wrong value, is never worse= =20 > than not initializing at all, and it does get rid of the warning. Never worse with regard to code correctness, but it can make later debugging harder. =20 Suppose there really is a yet unrecognized error. Eventually it bites us. If the compiler warning is still there, pointing a finger of blame at a=20 suspiciously relevant variable, then you have a big hint at where to start debugging. If the compiler is silent (because of the spurious initialization), then your error is no worse but you no longer have that debugging hint. The usual counter-argument is that real errors flagged in the compiler output may go unnoticed if they are buried in a flood of spurious warnings. =46ortunately, we are not in that position. The same concerns pertain to the other two warnings in the current build: color.c:516: warning: pointer targets in passing argument 2 of =E2=80=98map= 3d_position_r=E2=80=99 differ in signedness color.c:516: warning: pointer targets in passing argument 3 of =E2=80=98map= 3d_position_r=E2=80=99 differ in signedness set.c:2309: warning: pointer targets in passing argument 2 of =E2=80=98map_= position=E2=80=99 differ in signedness set.c:2309: warning: pointer targets in passing argument 3 of =E2=80=98map_= position=E2=80=99 differ in signedness The warning is correct, and points to an inconsistency in the 2D and 3D cod= e. We code hide the warning by casting the variable to singed or unsigned, but= then we would no longer have a reminder to deal someday with the real inconsiste= ncy. =2D-=20 Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle 98195-7742 |