Replacement for snprintf

Guillaume Piolat first.last at gmail.com
Mon Nov 4 13:49:08 UTC 2019


On Saturday, 2 November 2019 at 16:59:15 UTC, Jacob Carlborg 
wrote:
>
> It depends on what the goal is. If it is to have 100% 
> compatible drop-in replacement to snprintf then we need to 
> include the localization.
>
> But if the goal is just to have a function that converts values 
> to a string, which is implemented in D, then have the 
> opportunity to make a better interface.

+1 this is important since we've had localization bug and I 
suspect it's very easy to have such bugs.

Warning: `format` is affected too! (perhaps only when using the 
%f format specifier?)

https://github.com/AuburnSounds/printed/issues/22
ugly fix: 
https://github.com/AuburnSounds/printed/commit/797343c0fc213ea34aa5b79b61cdc1164ae189df


There is a non-zero chance that people _are_ relying on `format` 
and `snprintf` being localization-aware. So a "drop-in" 
replacement need to fix this mess by being bug-compatible, or not 
being drop-in.


More information about the Digitalmars-d mailing list