[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master b635c75 2/2: Work around a language defect
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master b635c75 2/2: Work around a language defect |
Date: |
Sun, 24 Mar 2019 15:48:35 -0400 (EDT) |
branch: master
commit b635c7510a1f7206c81d4e9ed76f043094bedc78
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Work around a language defect
It is ridiculous that <iomanip> prescribes an 'int' argument for
setprecision(int n);
but <ios> prescribes a 'std::streamsize' argument for
ios_base::precision(streamsize prec);
and especially that the LWG chose not to remove the inconsistency:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#1148
which was found in this case by compiling for 64-bit msw.
---
ihs_crc_comp.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ihs_crc_comp.cpp b/ihs_crc_comp.cpp
index 56499f6..18b1f72 100644
--- a/ihs_crc_comp.cpp
+++ b/ihs_crc_comp.cpp
@@ -321,8 +321,8 @@ void f_3(std::string const& line1, std::string const& line2)
<< rel_err
<< " " << d1
<< " vs. " << d2
- << std::setprecision(original_precision)
<< '\n';
+ std::cout.precision(original_precision);
}
//============================================================================
@@ -481,8 +481,8 @@ int try_main(int argc, char* argv[])
<< "Summary:"
<< " max abs diff: " << max_abs_diff
<< " max rel err: " << max_rel_err
- << std::setprecision(original_precision)
<< '\n';
+ std::cout.precision(original_precision);
is1.close();
is2.close();