|
From: Claudio V. C. <cv...@us...> - 2003-03-08 04:54:38
|
Blas Rodriguez Somoza wrote: > Subject: [Firebird-devel] REMOVAL of uninitialized warnings STARTING > > It seems there are no opposition, so I'll start to remove this > warnings today. Blas: I don't want this to happen if you are going to replace long chunk of uninitialized variables + code by long chunk of initialized variables + code I will only agree if you in turn agree to adhere strictly to C++ semantics: - define vars as close as the first point of usage, so they can be initialized to their first usable and sensible value and not an arbitrary value - define vars in the innermost scope where they need to be. I still prefer initialization over assignments in if() clauses, because they may be tricky to read otherwise and cause extra warnings: datatype value; // defined many lines above the next line: if ((value = fc()) != 0) // the !=0 test to silence the compiler ... For me, it's clearer to write datatype value = fc(); if (value) ... If you simply are going to turn the old C code into the same flock of top-defined variables with some values just to silence the compiler, then both the effort and the implied CVS activity don't make sense. Of course, there are places where several variables may need to be defined at the top and given an initial value, but these cases should be minimized. C. |