Skip to content

Commit

Permalink
Avoid min()/max() macro conflicts (google#201)
Browse files Browse the repository at this point in the history
Don't write `min(` or `max(` in headers as this conflicts with a
common Windows macro.  Use parens around the name to interrupt the
token sequence.
  • Loading branch information
devbww authored Oct 8, 2021
1 parent 9af727a commit 769622e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/cctz/time_zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ bool join_seconds(
count /= Num;
count -= 1;
}
if (count > std::numeric_limits<Rep>::max()) return false;
if (count < std::numeric_limits<Rep>::min()) return false;
if (count > (std::numeric_limits<Rep>::max)()) return false;
if (count < (std::numeric_limits<Rep>::min)()) return false;
*tpp = time_point<D>() + D{static_cast<Rep>(count)};
return true;
}
Expand All @@ -433,8 +433,8 @@ bool join_seconds(
time_point<std::chrono::duration<Rep, std::ratio<1, 1>>>* tpp) {
using D = std::chrono::duration<Rep, std::ratio<1, 1>>;
auto count = sec.time_since_epoch().count();
if (count > std::numeric_limits<Rep>::max()) return false;
if (count < std::numeric_limits<Rep>::min()) return false;
if (count > (std::numeric_limits<Rep>::max)()) return false;
if (count < (std::numeric_limits<Rep>::min)()) return false;
*tpp = time_point<D>() + D{static_cast<Rep>(count)};
return true;
}
Expand Down

0 comments on commit 769622e

Please sign in to comment.