Skip to content

Commit d4d5748

Browse files
committed
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.
1 parent be9a845 commit d4d5748

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/fast_float/ascii_number.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,14 @@ parse_int_string(UC const *p, UC const *pend, T &value,
482482
UC const *const first = p;
483483

484484
bool const negative = (*p == UC('-'));
485+
#ifdef FASTFLOAT_VISUAL_STUDIO
486+
#pragma warning(push)
487+
#pragma warning(disable : 4127)
488+
#endif
485489
if (!std::is_signed<T>::value && negative) {
490+
#ifdef FASTFLOAT_VISUAL_STUDIO
491+
#pragma warning(pop)
492+
#endif
486493
answer.ec = std::errc::invalid_argument;
487494
answer.ptr = first;
488495
return answer;

0 commit comments

Comments
 (0)