From d4d5748ec8d018944d3a0d5f87ac974579b7daf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=A5de?= Date: Thu, 16 Jan 2025 16:12:34 +0100 Subject: [PATCH] Silenced Visual Studio compiler warning This code caused a C4127 "conditional expression is constant" compiler warning when compiled with Visual Studio at warning level 4 with T a signed integer type. --- include/fast_float/ascii_number.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 25ac40d..9001016 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -482,7 +482,14 @@ parse_int_string(UC const *p, UC const *pend, T &value, UC const *const first = p; bool const negative = (*p == UC('-')); +#ifdef FASTFLOAT_VISUAL_STUDIO +#pragma warning(push) +#pragma warning(disable : 4127) +#endif if (!std::is_signed::value && negative) { +#ifdef FASTFLOAT_VISUAL_STUDIO +#pragma warning(pop) +#endif answer.ec = std::errc::invalid_argument; answer.ptr = first; return answer;