From ecf92a03a97ed7cc10b6ff540a96425288f5f24a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sat, 22 Feb 2020 22:29:13 -0500 Subject: [PATCH] Add more mingw debug --- include/boost/static_string/static_string.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index 6c26c20..a977973 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -21,6 +21,8 @@ #include #include +#include + namespace boost { namespace static_string { @@ -540,10 +542,13 @@ to_static_wstring_float_impl(long double value) noexcept { // extra one needed for null terminator wchar_t buffer[N + 1]; + std::cout << "buffer size: " << (N + 1) << '\n'; // swprintf returns a negative number if it can't // fit all the characters in the buffer std::cout << "trying swprintf\n"; - if (std::swprintf(buffer, N + 1, L"%Lf", value) < 0) + const int res = std::swprintf(buffer, N + 1, L"%Lf", value); + std::cout << "swprintf res: " << res << '\n'; + if (res < 0) { std::cout << "swprintf < 0\n"; // the + 4 is for the decimal, 'e', @@ -552,8 +557,9 @@ to_static_wstring_float_impl(long double value) noexcept (std::max)(std::size_t(2), count_digits( std::numeric_limits::max_exponent10)) + 4; const int precision = N > reserved_count ? N - reserved_count : 0; + std::cout << "pre: " << precision << '\n'; // switch to scientific notation - std::swprintf(buffer, N + 1, L"%.*Le", precision, value); + std::cout << "sci: " std::swprintf(buffer, N + 1, L"%.*Le", precision, value) << '\n'; } // this will not throw return static_wstring(buffer);