Replacement for snprintf

lithium iodate whatdoiknow at doesntexist.net
Wed Nov 6 17:48:00 UTC 2019


On Wednesday, 6 November 2019 at 17:28:58 UTC, H. S. Teoh wrote:
> Yes, I think in the long run this will be the more viable 
> approach. Depending on locale as a global state is problematic 
> because it forces formatting to be impure, and also forces 
> users to implement hacks when they need to temporarily change 
> the locale. E.g., in a system like snprintf, if you need to 
> format German text with snippets of English quotations, you 
> will have to temporarily override LC_* somehow in order to 
> print a number with two different separators, or hack it with 
> string postprocessing, etc..

All while setlocale doesn't even provide any sort of 
thread-safety!



More information about the Digitalmars-d mailing list