From 6d84f9a41ba5a3ee3c959ac208911e20dd977d4e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 17 Oct 2021 16:43:02 +0300 Subject: [PATCH] Print size_t and floating point widths in hash_info --- test/hash_info.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/test/hash_info.cpp b/test/hash_info.cpp index 2a6c2c1..c0b8ec7 100644 --- a/test/hash_info.cpp +++ b/test/hash_info.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #if defined(BOOST_MSVC) @@ -61,16 +63,15 @@ void write_compiler_info() { #endif +#define PRINT(x) std::cout << #x ": " << x << std::endl + int main() { write_compiler_info(); + std::cout << std::endl; - std::cout << "__cplusplus: " - << __cplusplus - << std::endl; - - std::cout << "BOOST_CXX_VERSION: " - << BOOST_CXX_VERSION - << std::endl; + PRINT(__cplusplus); + PRINT(BOOST_CXX_VERSION); + std::cout << std::endl; #if defined(BOOST_NO_CXX17_HDR_STRING_VIEW) std::cout << "No " << std::endl; @@ -102,4 +103,22 @@ int main() { std::cout << "Has " << std::endl; #endif + std::cout << std::endl; + + PRINT(CHAR_BIT); + std::cout << std::endl; + + PRINT(sizeof(std::size_t)*CHAR_BIT); + std::cout << std::endl; + + PRINT(sizeof(float)*CHAR_BIT); + PRINT(std::numeric_limits::digits); + std::cout << std::endl; + + PRINT(sizeof(double)*CHAR_BIT); + PRINT(std::numeric_limits::digits); + std::cout << std::endl; + + PRINT(sizeof(long double)*CHAR_BIT); + PRINT(std::numeric_limits::digits); }