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_uint64_t))
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.
|