Possible Bug in INT_STRLEN_MAXIMUM macro

Olson, Arthur David (NCI) olsona at dc37a.nci.nih.gov
Mon Aug 24 13:17:34 UTC 1998

	-----Original Message-----
	From:	Randy Thelen [SMTP:rthelen at netapp.com]
	Sent:	Friday, August 21, 1998 7:17 PM
	To:	tz at elsie.nci.nih.gov
	Cc:	guy at netapp.com
	Subject:	Possible Bug in INT_STRLEN_MAXIMUM macro

	The INT_STRLEN_MAXIMUM macro in lib/private.h used by, among other
	files, asctime.c, states in its comment field:

	** 302 / 1000 is log10(2.0) rounded up.

	And then in the macro definition we find:

	#define INT_STRLEN_MAXIMUM(type) \
	    ... * 302 / 100 ...

	Me thinks this is not what was intended.  Possibly it's an error,
	possibly it's the right thing.  Could you send mail back telling me if
	this was on purpose?

	-- Randy Thelen
	Software Engineer
	Network Appliance, Inc.

The bad news is that the macro definition indeed fails to match the comment; the
good news is that the error results in over-generous sizing of arrays designed
to hold ASCII representations of numbers.
I've changed the "100" in the "#define" to the correct "1000"; the change will
show up in the
next version of tzcode.


More information about the tz mailing list