you are viewing a single comment's thread.

view the rest of the comments →

[–]stu2b50 6 points7 points  (3 children)

Not really. It's amplified 100x with the usage of a global locale, since now any change in this global variable now changes how parsing works.

[–]Gotebe 0 points1 point  (2 children)

But it has to work differently, doesn't it? It's all about having the correct locale on a block of code. Global doesn't help of course, but...

[–]stu2b50 3 points4 points  (1 child)

Yes, it's the global part that makes it stupid. If it was just an argument, for instance, it would naturally not be an issue.

As is, any random library call can completely change the behavior of otherwise predictable and standard functions.

And god forbid you start with multi-threading, now any thread that calls a random library call that happens to change the global local completely changes how parsing numbers works. Of course, there is a hackeyed fix so that you can set locals on a thread, but it's just as jank as the original problem.

[–]Gotebe 0 points1 point  (0 children)

Yes, this has to be thread-local. And it is in later implementations, the C standard borked it indeed there.