Commit 46d36062 by Paolo Carlini Committed by Paolo Carlini

locale_facets.tcc (num_put::_M_convert_float): Extend comment, reduce __cs_size…

locale_facets.tcc (num_put::_M_convert_float): Extend comment, reduce __cs_size for non-fixed outputs.

2001-12-07  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/locale_facets.tcc (num_put::_M_convert_float):
	Extend comment, reduce __cs_size for non-fixed outputs.

From-SVN: r47767
parent 9975c6d4
2001-12-07 Paolo Carlini <pcarlini@unitus.it> 2001-12-07 Paolo Carlini <pcarlini@unitus.it>
* include/bits/locale_facets.tcc (num_put::_M_convert_float):
Extend comment, reduce __cs_size for non-fixed outputs.
2001-12-07 Paolo Carlini <pcarlini@unitus.it>
* include/bits/basic_string.tcc (_M_mutate): Fix typo * include/bits/basic_string.tcc (_M_mutate): Fix typo
in the previous check in. in the previous check in.
......
...@@ -762,9 +762,13 @@ namespace std ...@@ -762,9 +762,13 @@ namespace std
// Consider the possibility of long ios_base::fixed outputs // Consider the possibility of long ios_base::fixed outputs
const bool __fixed = __io.flags() & ios_base::fixed; const bool __fixed = __io.flags() & ios_base::fixed;
const int __max_exp = numeric_limits<_ValueT>::max_exponent10; 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 const int __cs_size = __fixed ? __max_exp + __max_digits + 4
: __max_digits * 4; : __max_digits * 3;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
int __len; int __len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment