Replacement for snprintf

berni44 dlang at
Wed Oct 30 19:19:06 UTC 2019

On Wednesday, 30 October 2019 at 17:50:03 UTC, Jon Degenhardt 
> It's reasonably common to have numeric values written out in 
> text format and read back in and used in subsequent 
> computations. Not always a great idea, especially when done 
> without much consideration for round-off errors. But it's not 
> uncommon.

But IMHO this is the fault of people who do this and not the 
fault of a printing routine.

But: When pondering about how to fix the results of format for 
ranges of strings (it places currently quotes arround each 
string, which is somewhat inconsistent because single strings are 
printed without quotes, and causes confusion).

I came up with the idea of having a new format qualifier, maybe S 
like source, in addition to s, which prints the type in a way, 
that it can be directly used in D code (which is, as far as I 
know, the reason why the quotes are printed). That could be also 
used, to produce a representation of a float, that, when readin, 
is still the same float as before; which could be done by ryu or 
grisu algorithm, because these algorithms have exactly this goal.

More information about the Digitalmars-d mailing list