logoalt Hacker News

daemin • yesterday at 8:15 AM • 2 replies • view on HN

>> Also changes based on locale,

> That's a feature: Where did the string come from if not the user?

Many games and applications store floating point values in text file formats. This has caused bugs in those programs many times over because they didn't realise it was locale dependent and the data parsing broke in another locale.


Replies

CamperBob2 • yesterday at 3:51 PM

I don't support the nonstandard use of commas as decimal points in my software, so that's not an issue for me. That's a hill for the Europeans to live and die on. "Gotta be different from everybody else" has a price.

➕ show 2 replies
geocar • yesterday at 10:45 AM

> Many games and applications store floating point values in text file formats.

And why, pray tell, would those games and applications ship with text files containing floating point values that were invalid?

Certainly if they produce the values, strtod() is sure to work, and worrying about errors at that level just doesn't make any sense at all.

> This has caused bugs in those programs

I'm sorry this just isn't true: The programmer caused the bugs in those programs and nobody else.

Meanwhile users who produce text files with floating point numbers in their locale expect program that load those text files to tolerate their locale, and those programs should not be using strtod()!

➕ show 1 reply