apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject [PATCH] hex format string for apr_uint64_t
Date Tue, 15 Apr 2003 17:58:23 GMT
Hopefully there isn't a reason why this can't be implemented portably. 
Speak up quickly if you know of one :)

Apache needs to format a 64-bit quantity in hex in a few places.  Since 
hex formatting is typically supported for unsigned values only, the best 
compromise seems to be to have a format string for APR_UINT64_T and cast 
the argument to apr_uint64_t (if it is known to be safe in that context, 
of course).

An unfortunately ugly example:

   apr_time_t now;

   apr_snprintf(..., "microsecs in hex: %" APR_UINT64_T_HEX_FMT,

APR_TIME_T_HEX_FMT wouldn't be pretty since apr_time_t is signed but hex 
formats take unsigned arguments.  At least APR_UINT64_T_HEX_FMT is good 
clean fun by itself.

View raw message