changeset 1164:6c159b8362ff broker

removing std::stod()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 19 Nov 2019 21:18:46 +0100
parents ba9db2ad317c
children 4d97f532f1e0
files Framework/Toolbox/LinearAlgebra.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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]);