Skip to content

Commit

Permalink
Silenced Visual Studio compiler warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrade committed Jan 16, 2025
1 parent be9a845 commit d4d5748
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/fast_float/ascii_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d4d5748

Please sign in to comment.