3 ms·
cheap jabs at the venerable printf(...) notwithstanding, this article is ok. however, i must confess, string formatting still sucks in plain C++, and snprintf(.
by signa11 9y ago
cheap jabs at the venerable printf(...) notwithstanding, this article is ok. however, i must confess, string formatting still sucks in plain C++, and snprintf(...) is not too shabby.
- reality_czech 9y agoThe cheap jabs are all incorrect, as well. Any compiler from the last 10 years will warn you if you don't match your printf format string to the arguments. printf also supports reordering arguments using the %m$ syntax (read the man page). And yes, you can extend printf with your own types. A better guide to using strings in C++ is here: https://yosefk.com/c++fqa/io.html https://yosefk.com/c++fqa/io.html
- nikbackm 9y agoDoes the compiler also warn when you don't use a literal format string?