Here’s my article in the May 2015 issue of MSDN Magazine. This is the special edition of the magazine that was available at Build 2015.
I explored some techniques for making printf more convenient to use with modern C++ in my March 2015 column. I showed how to transform arguments using a variadic template in order to bridge the gap between the official C++ string class and the antiquated printf function. Why bother? Well, printf is very fast, and a solution for formatted output that can take advantage of that while allowing developers to write safer, higher-level code is certainly desirable.
While this is a convenient bridge between modern C++ and the traditional printf function, it does nothing to resolve the difficulties of writing correct code using printf. printf is still printf and I’m relying on the not entirely omniscient compiler and library to sniff out any inconsistencies between conversion specifiers and the actual arguments provided by the caller.
Surely modern C++ can do better.