You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Mikhail T." <mi...@aldan.algebra.com> on 2010/06/08 20:13:33 UTC

apr_vformatter and the %p-format

Why does the apr_vformatter -- and thus all its callers (apr_psprintf, 
logging-functions, etc.) reject the %p format (replacing it with words 
``bogus %p'')?

The format is for outputting pointers and is supported by the 
C-library's printf-family.

If this is a deliberate limitation, I'd like to know, what the 
motivations are. If it is simply an omission, I may be able to offer a 
patch...

Please, advise. Thanks! Yours,

    -mi


Re: apr_vformatter and the %p-format

Posted by "Mikhail T." <mi...@aldan.algebra.com>.
08.06.2010 14:13, Mikhail T. ???????(??):
> Why does the apr_vformatter -- and thus all its callers (apr_psprintf, 
> logging-functions, etc.) reject the %p format (replacing it with words 
> ``bogus %p'')?
>
> The format is for outputting pointers and is supported by the 
> C-library's printf-family.
>
> If this is a deliberate limitation, I'd like to know, what the 
> motivations are. If it is simply an omission, I may be able to offer a 
> patch...
Ok, replying to myself... Apparently, one is supposed to use %pp instead 
of simple %p to output pointers. This is not well-implemented, however, 
because real printf would left-pad pointers with zeros, which is not 
even possible to request with the current apr_vformatter implementation. 
The 0x-prefix is not output either, but that one can request by 
explicitly putting it into format.

Also, trying to use %pt (for the thread ID) -- gets flagged by the gcc's 
-Wformat, because these functions are, somewhat misleadingly, declared 
"printf-like".

    -mi