This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

[PATCH, preapproved] Comment and minor fix in locale_facets.tcc


Hi,

I have committed the following patch, preapproved by Benjamin Kosnik.
Tested i686-pc-linux-gnu.

Cheers,
Paolo.

////////////////////

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.

===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- gcc/libstdc++-v3/include/bits/locale_facets.tcc     2001/12/07 02:58:36     1.41
+++ gcc/libstdc++-v3/include/bits/locale_facets.tcc     2001/12/07 19:00:07     1.42
@@ -762,9 +762,13 @@
        // 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<char*>(__builtin_alloca(__cs_size));

        int __len;




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