absyntax_utils/absyntax_utils.cc
changeset 571 97b85630e496
parent 568 5f79478142d7
child 576 8368ec909825
--- a/absyntax_utils/absyntax_utils.cc	Fri Jun 08 19:47:45 2012 +0100
+++ b/absyntax_utils/absyntax_utils.cc	Sat Jun 09 08:35:46 2012 +0100
@@ -129,6 +129,7 @@
   for(unsigned int i = 3; i < strlen(hex_integer->value); i++)
     if (hex_integer->value[i] != '_') str += hex_integer->value[i];
     
+  errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
   ret = strtoull(str.c_str(), &endptr, 16);
   if (errno != 0) ERROR;
 
@@ -148,6 +149,7 @@
   for(unsigned int i = 3; i < strlen(real_sym->value); i++)
     if (real_sym->value[i] != '_') str += real_sym->value[i];
     
+  errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
   #if    (real64_t  == float)
     ret = strtof(str.c_str(), NULL);
   #elif  (real64_t  == double)