On 2023-08-03 19:51, John Cowan wrote:
On Thu, Aug 3, 2023 at 1:29 PM Alejandro Colomar
<alx.manpages(a)gmail.com>
wrote:
But if speed is not a problem, I'd keep the good ol' syntax that
everybody knows. No need to make everybody learn a "cool" new print
function, that probably won't be as tunable
as printf(3) is.
By that argument, there would be no C, only Algol 68 and PL/I, or subsets
of them.
I didn't claim that there's never a reason to invent new syntax. My claim
was rather that in this case, there isn't.
- printf(3) is more powerful than any other existing formatting function
that I know of any language --I'm still curious of what's the equivalent
of "%+'0#8.5f" in other formatting functions--.
- It is also reasonably fast (at least for such a highly-customizable
formatting function), and I'd like to see any system beat that while
keeping the customizability.
- It is type-safe, with the right tools.
I can understand the need for less-customizable faster formatting functions
for very-high-performance programs, and std::format may fit well there. But
other than that, I don't see a reason to invent so many different formatting
functions. Of course, one may do that just for fun, in which case I applaud
that. But printf(3) is superior to them, IMO.
Alex