From 46d360629c51103214a197e1b208fc365c9e55db Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 7 Dec 2001 20:00:07 +0100 Subject: [PATCH] locale_facets.tcc (num_put::_M_convert_float): Extend comment, reduce __cs_size for non-fixed outputs. 2001-12-07 Paolo Carlini * include/bits/locale_facets.tcc (num_put::_M_convert_float): Extend comment, reduce __cs_size for non-fixed outputs. From-SVN: r47767 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/bits/locale_facets.tcc | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 26cad181b46..4e32aa306f3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2001-12-07 Paolo Carlini + + * include/bits/locale_facets.tcc (num_put::_M_convert_float): + Extend comment, reduce __cs_size for non-fixed outputs. + 2001-12-07 Paolo Carlini * include/bits/basic_string.tcc (_M_mutate): Fix typo diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 363ff8b54a0..51bc9edb5dc 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -762,9 +762,13 @@ namespace std // Consider the possibility of long ios_base::fixed outputs const bool __fixed = __io.flags() & ios_base::fixed; const int __max_exp = numeric_limits<_ValueT>::max_exponent10; - // XXX Why + 4? Why * 4? What's going on? Who's on first? + // ios_base::fixed outputs may need up to __max_exp+1 chars + // for the integer part + up to __max_digits chars for the + // fractional part + 3 chars for sign, decimal point, '\0'. On + // the other hand, for non-fixed outputs __max_digits*3 chars + // are largely sufficient. const int __cs_size = __fixed ? __max_exp + __max_digits + 4 - : __max_digits * 4; + : __max_digits * 3; char* __cs = static_cast(__builtin_alloca(__cs_size)); int __len; -- 2.30.2