Khanattila / KNLMeansCL

An optimized OpenCL implementation of the Non-local means de-noising algorithm
GNU General Public License v3.0
106 stars 22 forks source link

Don't change the locale #43

Open myrsloik opened 5 years ago

myrsloik commented 5 years ago

You can't change the locale if you're a library. It affects everything else that's also loaded and can actually cause locale related operations in other threads to crash. Apart from all the fun logic errors that can happen in applications that at least assume the decimal separator to be constant.

Just use snprintf_l (_snprintf_l on windows) and do it right. Or use C++ streams where the locale can be set locally as well.

Khanattila commented 5 years ago

Yeah, I definitely wrote this library not really optimally. I had in mind to buy a Vega GPU and fix all the crap, but then the scarce availability and the crypto mining happened. Finally, with Navi GPU I should be able to do it.