printf() implementation comparison

This page is a rough comparison between various printf() implementaions. Not all printf() implementations are equal, while almost all will do the 'd', 'ld', 'u', 'lu', and 's' convertions ... even just adding a precision to one of the int formatters might not do the right thing.

Note that if you want a portable version of printf() in your code, you are much better off using something that natively parses the format string. This ensures that you get the same parsing behaviour on all platforms. Otherwise you are just waiting for your code to be run on some weird platform, and crash or possibly have a security problem. Note that this page gives information about what you should look for in a string library printf implementation, and the problems with just using the host implementation sprintf()/snprintf() calls.

For a comparison of string libraries, some of which include a portable printf() like function, you should look at this page

If you want to learn how printf() implementations are written, you can look at this simple printf code. However if you want to use one I'd recommend one of the better ones from the below list as they have more features and comply to the standards better.

Any corrections or omissions you see in the above, feel free to contact me at the address below


James Antill
Last modified: Sun Jul 31 00:33:54 EDT 2005