httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: [PATCH] 10x performance increase patch #1
Date Fri, 09 Jul 1999 01:00:44 GMT
Dean Gaudet wrote:
> In your docs for printf you suggest using the long forms of everything,
> such as %lu ... and then casting to (long).  Unfortunately, this doesn't
> work on the other families of 64-bit systems where long is 32-bits, and
> long long is 64-bits... and the cast removes the warnings, so the bug is
> lost.
> But I can't think of a clean solution -- except to stop using printf-like
> routines.

Take a look at what Jim did in ap_snprintf.c. There is a type named
"widest_int". Just case the printf argument to that and use the %q
format code. On platforms with "long long" support, then you're set. If
the platform doesn't have it, then widest_int is a "long" and %q
interprets the value as a long.

That is certainly cleaner, if not perfect.

I might suggest promoting the widest_int types out of ap_snprintf and
formalizing them for use within more of Apache. The parameter that is
passed to the printf could use that type, rather than needing a cast.


Greg Stein,

View raw message