# HG changeset patch # User Sebastien Jodogne # Date 1574194726 -3600 # Node ID 6c159b8362fff9c4b37869d9b4aefe3eb0a21ec4 # Parent ba9db2ad317ca1e7632173b0792c0018555f827f removing std::stod() diff -r ba9db2ad317c -r 6c159b8362ff Framework/Toolbox/LinearAlgebra.cpp --- a/Framework/Toolbox/LinearAlgebra.cpp Tue Nov 19 20:44:55 2019 +0100 +++ b/Framework/Toolbox/LinearAlgebra.cpp Tue Nov 19 21:18:46 2019 +0100 @@ -74,13 +74,23 @@ for (size_t i = 0; i < items.size(); i++) { /** + * SJO - 2019-11-19 - WARNING: I reverted from "std::stod()" + * to "boost::lexical_cast", as "std::stod()" is sensitive to + * locale settings, making this code non portable and very + * dangerous as it fails silently. A string such as + * "1.3671875\1.3671875" is interpreted as "1\1", because + * "std::stod()" expects a comma (",") instead of a point + * ("."). + **/ + +#if 0 // __cplusplus >= 201103L // Is C++11 enabled? + /** * We try and avoid the use of "boost::lexical_cast<>" here, * as it is very slow. As we are parsing many doubles, we * prefer to use the standard "std::stod" function if * available: http://www.cplusplus.com/reference/string/stod/ **/ -#if __cplusplus >= 201103L // Is C++11 enabled? try { target[i] = std::stod(items[i]);