[tz] proposed changes for Win32 and a improved mktime() algorithm
Paul Eggert
eggert at cs.ucla.edu
Wed May 10 14:51:36 UTC 2017
On 05/10/2017 04:34 AM, Kees Dekker wrote:
> I forgot something: warnings about not initialized variables are almost always triggered because there is a
> If else[/if else].. codepath, where one of the codepaths uses a variable that is not initialized somewhere.
Yes, here's an example of the problem:
bool ok = complicated condition;
int value;
if (ok)
value = complicated expression;
complicated actions;
if (ok)
return value;
An inferior compiler might complain that 'value' might be used
uninitialized. One can pacify such a compiler by changing line 2 to 'int
value = 0;', and you're correct that this typically won't slow the code
down significantly. However, such a change obfuscates the source code,
as the reader is left wondering why the unnecessary initialization is
present. Instead, it's better to disable or ignore the bogus warnings,
or get a better compiler. After all, there's nothing wrong with this
code, and your compiler is supposed to be your servant not your master.
More information about the tz
mailing list