On 16/06/2020 13:44, Laurent Pinchart wrote:
I do like to keep local variables inside smaller scopes when possible,
as it reduces chances for bugs. Any reason you moved i to the whole
function scope?
I do the same as well, but tend to keep variables used in multiple
smaller scopes as top-level variables. I'm fine multiple instances of
'i' if you prefer.
Then you risk having the first use initialize the variable, and the second use missing
initialization but using it as initialized from the first use. And the compiler doesn't warn about
the bug.
If changing it here would create lots of conflicts (as this is in the beginning of the series), it's
fine.
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki