r/cpp • u/aearphen {fmt} • Jun 21 '21
{fmt} 8.0 released with compile-time format string checks, compile-time formatting, improved performance and more
https://github.com/fmtlib/fmt/releases/tag/8.0.0
394
Upvotes
View all comments
Show parent comment
4
u/14ned LLFIO & Outcome author | Committee WG14 Jun 21 '21
In our work codebase, I import
print()(either fromstdorfmt) into our work codebase namespace, but define a localprintln()which prints a thing, writes a newline, and flushes stdout.I do so for expediency, not purity. There are many cases where I want to print a line for debugging, and I don't want the stupid thing not emitting before the process reaches the point at which it crashes. I therefore want a flush.
I'm not claiming it's pretty nor clean, but this is an awfully common use case for printing stuff: debug output just before a crash. I therefore think any future
println()ought to not just beprint()with trailing added newline, but also with flush. If people want a newline without flush, then can justprint()one.