3 ms·
In the area of string formatting, templated C++ library should outperform C printf in theory, but this has been difficult to achieve in practice. So I understan
by sanxiyn 10y ago
In the area of string formatting, templated C++ library should outperform C printf in theory, but this has been difficult to achieve in practice. So I understand why many people are skeptical about your "in practice" claim.
- charles-salvia 10y agoWith iostream, yeah - but in general C++ templates give the compiler more opportunity to outperform similar generic C code that relies on void pointers/function pointers. See the classic qsort vs. std::sort archetypal example of this. Also, with printf in particular, modern C compilers will generally parse the format flags at compile time if possible.