changeset 10378:eeb6c09ec51a

avoid g++ extension in str2double
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 01 Mar 2010 09:49:56 +0100
parents fb62fbbe28c0
children f578e6468d0c
files src/ChangeLog src/DLD-FUNCTIONS/str2double.cc
diffstat 2 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Feb 28 23:27:09 2010 -0500
+++ b/src/ChangeLog	Mon Mar 01 09:49:56 2010 +0100
@@ -1,3 +1,8 @@
+2010-03-01  Jaroslav Hajek  <highegg@gmail.com>
+
+	* DLD-FUNCTIONS/str2double.cc (str2double1): Use ISO-conformant code
+	for setting the real and imaginary part.
+
 2010-02-28  David Bateman  <dbateman@free.fr>
 
 	* DLD-FUNCTIONS/urlwrite.cc (curl_handle::init): Don't set
--- a/src/DLD-FUNCTIONS/str2double.cc	Sun Feb 28 23:27:09 2010 -0500
+++ b/src/DLD-FUNCTIONS/str2double.cc	Mon Mar 01 09:49:56 2010 +0100
@@ -157,9 +157,17 @@
   else
     {
       if (i1)
-        val.imag () = num;
+#ifdef __GNUC__
+        val.imag () = num; // GNU C++
+#else
+        val = Complex (val.real (), num); // ISO C++
+#endif
       else
-        val.real () = num;
+#ifdef __GNUC__
+        val.real () = num; // GNU C++
+#else
+        val = Complex (num, val.imag ()); // ISO C++
+#endif
 
       if (! is.eof ())
         {
@@ -168,9 +176,17 @@
           else
             {
               if (i2)
-                val.imag () = num;
+#ifdef __GNUC__
+                val.imag () = num; // GNU C++
+#else
+                val = Complex (val.real (), num); // ISO C++
+#endif
               else
-                val.real () = num;
+#ifdef __GNUC__
+                val.real () = num; // GNU C++
+#else
+                val = Complex (num, val.imag ()); // ISO C++
+#endif
             }
         }
     }