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.
This commit is contained in:
Johan Råde 2025-01-16 16:12:34 +01:00
parent be9a8453c4
commit d4d5748ec8

View File

@ -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<T>::value && negative) {
#ifdef FASTFLOAT_VISUAL_STUDIO
#pragma warning(pop)
#endif
answer.ec = std::errc::invalid_argument;
answer.ptr = first;
return answer;