[tz] proposed changes for Win32 and a improved mktime() algorithm

Kees Dekker Kees.Dekker at infor.com
Thu May 11 07:26:59 UTC 2017


>On Wed, 10 May 2017, Kees Dekker wrote:
>> 2. Adding int value = 0 (or any initializing value what is wanted) does not reduce the readability of the code. If it does, I canʼt imagine how.

>Killing warnings this way - kills warnings from all compilers, good and 
>bad.  Warnings are meant to expose problems in code, and if they are 
>killed, bugs introduced later might not be detected.  In code that will be 
>maintained for thousands of years (I hope) this counts.

It is a good practice to write code like:

int f ()
{
	// error return at default
	int ret = -1;
	if (all-ok) {
		// success
		ret = 0;
	}
	return ret;
}

This has nothing to do with suppressing potential bugs. Because the 'possibly not initialized' warnings are very compiler dependent, 
Including compilers that never warn/check these issues, you can't rely on your compiler whether it will tell that something is not
Initialized. If a compiler never complains about uninitialized code, a first initialization will prevent you from making bugs.

Regards,
Kees


More information about the tz mailing list