[PATCH RFC] roll our own printf implementation
Mike Frysinger
vapier at gentoo.org
Tue Apr 3 05:48:07 UTC 2012
On Friday 30 March 2012 16:08:36 Denys Vlasenko wrote:
> On 03/30/2012 08:24 PM, Mike Frysinger wrote:
> > it's hard to say that having to add casts to arguments is an improvement.
> > are those really necessary?
>
> Casts are necessary only when you print chars or shorts -
> a rare operation. As you see, in the entire strace tree
> only four tprintf calls needed tweaking.
>
> Strictly speaking, casts may be not necessary - IIRC,
> variadic function arguments are auto-promoted to int anyway.
> But I prefer to not rely on my vague recollections
> of C standards - I'd use casts instead.
>
> It is possible to retain ability to understand %h[h]u,
> but is it worth slowing down every tprintf for just four
> cases where we use it?
considering we already have to handle length chars, i can't see the
introduction of one more char processing being hugely detrimental. do you
have data to show that this doesn't work ?
the problem with rolling your own limited printf() is the lack of
documentation on what is actually supported and the lack of compile time
checking on what modifiers/etc... are actually respected.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120403/0224db33/attachment.bin>
More information about the Strace-devel
mailing list