|
Farid Zaripov made changes - 02/Nov/07 06:17 PM
[
Permlink
| « Hide
]
Farid Zaripov added a comment - 02/Nov/07 06:19 PM
The reason is the fixed size buffer in num_get<_CharT, _InputIter>::_C_get(), _num_get.cc, line 253.
I don't necessarily think this is a problem with the fixed buffer size. It seems more like a problem of not skipping unnecessary zeros.
In this specific case we could just skip the leading zeros but there are other cases it wouldn't work (e.g., 1<N random digits>e-<N> should parse and evaluate to 1 for any value of N).
Disabled formatting.
Set Fix Version's to 4.2.1.
Farid Zaripov made changes - 03/Apr/08 06:57 PM
Farid Zaripov made changes - 03/Apr/08 06:57 PM
Martin, are you sure that 10e-1 should be parsed into 1 instead of 10?
I've tested on MSVC with native STL and STLport and both returned 10 instead of 1. From the standard (22.2.2.1.2 p3): Stage 3: The result of stage 2 processing can be one of — A sequence of chars has been accumulated in stage 2 that is converted (according to the rules of scanf) to a value of the type of val . This value is stored in val and ios_base::goodbit is stored in err . The following code assigns lvar to 10 on MSVC: long lvar;
scanf ("10e-1", "%ld", &lvar);
That depends if it's being parsed as an integer or floating point number. If the former, it should be 10, otherwise 1.
Farid Zaripov made changes - 04/Apr/08 10:51 AM
Farid Zaripov made changes - 17/Apr/08 11:38 AM
The patch is attached.
ChangeLog: STDCXX-640 * include/loc/_num_get.cc (_C_get): Increase size of the __buf and __grpbuf using __rw::__rw_tmpbuf() if needed. * include/rw/_tmpbuf.h: New header file with a declaration of the __rw::__rw_tmpbuf(). * include/rw/_rawiter.h: #include <rw/_tmpbuf.h> for declaring __rw::__rw_tmpbuf(). * src/tmpbuf.cpp: Ditto.
Farid Zaripov made changes - 17/Apr/08 07:49 PM
Farid Zaripov made changes - 17/Apr/08 07:49 PM
Farid Zaripov made changes - 17/Apr/08 07:49 PM
Too late to fix in 4.2.1 but should consider for 4.2.2 if appropriate due to binary compatibility constraints.
Martin Sebor made changes - 23/Apr/08 05:18 AM
Farid Zaripov made changes - 14/May/08 04:45 PM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||