mpllibs icon indicating copy to clipboard operation
mpllibs copied to clipboard

safe_printf feature request

Open rockeet opened this issue 10 years ago • 1 comments

I read and tested your safe_printf, it was amazed me... So, what I need is not only "safe", but also "convenient", for example, I want (maybe many people want too) such a features: When I write safe_printf<"%d %X %s">(10LL, 11L, std::string("abc")), my intention is really safe_printf<"%lld %lX %s">(10LL, 11L, std::string("abc").c_str()). In C++11, it is possible to convert the original format string with the intended one, so, we needn't to specify the redundant width format specifier and s.c_str() ect...

rockeet avatar Apr 25 '14 06:04 rockeet

With safe_printf in its current form you can easily replace it with the original printf if you want to compile quickly. Extra type conversions based on the format string would not make it possible.

Some new placeholder notation could be added to the format string to express that printf should detect the type of the argument and use that.

sabel83 avatar Apr 27 '14 08:04 sabel83