This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/7920: std::numeric_limits<char>::digits10 is incorrect (7, not 3)


>Number:         7920
>Category:       libstdc++
>Synopsis:       std::numeric_limits<char>::digits10 is incorrect (7, not 3)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 14 20:46:08 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     sbeasley@cs.uic.edu
>Release:        gcc version 3.1.1 20020703 (Debian prerelease)
>Organization:
>Environment:
Linux x86 2.4.17
>Description:
std::numeric_limits<char>::digits10 on this system reports 7, not 3 as expected. The source indicates that the macros used to obtain this value inadvertently use the value of std::numeric_limits<char>::digits, which is 7.
>How-To-Repeat:
std::cout << std::numeric_limits<char>::digits10;
>Fix:
Two macros in libstdc++/include/std/std_limits.h must be changed to use digits10 instead of digits. Attached is a diff -Naur of the file. Of particular interest:

-#  define __glibcpp_char_digits10 __glibcpp_signed_char_digits
+#  define __glibcpp_char_digits10 __glibcpp_signed_char_digits10

-#  define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits
+#  define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits10
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="patch.txt"
Content-Disposition: inline; filename="patch.txt"

--- std_limits.h        2002-09-14 22:12:08.000000000 -0500
+++ std_limits_fixed.h  2002-09-14 22:12:55.000000000 -0500
@@ -364,12 +364,12 @@
 #  define __glibcpp_char_min (char)__glibcpp_signed_char_min
 #  define __glibcpp_char_max (char)__glibcpp_signed_char_max
 #  define __glibcpp_char_digits __glibcpp_signed_char_digits
-#  define __glibcpp_char_digits10 __glibcpp_signed_char_digits
+#  define __glibcpp_char_digits10 __glibcpp_signed_char_digits10
 #else
 #  define __glibcpp_char_min (char)__glibcpp_unsigned_char_min
 #  define __glibcpp_char_max (char)__glibcpp_unsigned_char_max
 #  define __glibcpp_char_digits __glibcpp_unsigned_char_digits
-#  define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits
+#  define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits10
 #endif

 // short


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]