3 ms·
Excuse the lack of context here, I haven't dealt much with locale's in C, and I'm probably showing my ignorance. Why would you ever mutate a locale object? Is
by MobiusHorizons 5y ago
Excuse the lack of context here, I haven't dealt much with locale's in C, and I'm probably showing my ignorance.
Why would you ever mutate a locale object? Is that the common way to change locales in C? Wouldn't it make more sense to have locale objects be roughly immutable? It doesn't seem like they should have any real reason to change very often in a typical use-case. I would think any given person only has a small (1-3 or so) number of locale's they use on any regular basis.
Are locale objects being mutated really common enough that you need a mutex to protect against accidentally rendering something in the wrong locale?
- mort96 5y agoI would guess that there's just nothing in the standard which _prevents_ people from changing the locale. So if you want a conforming implementation, you need your implementation to work if the programmer changed the locale object directly. EDIT: Nevermind, sprintf_l isn't part of the C standard, so really they could be implemented however the authors chose.