Skip to content

Commit a53f2ae

Browse files
fix: avoid max/min macros from colliding with calls to std::numeric_limits<uint32_t>::max (#942)
Windows headers (e.g. minwindef.h) define min and max macros which collied with std::numeric_limits<uint32_t>::max. The C (and therefore C++) preprocessor automatically expands function like macros. i.e. macro identifiers immediately followed by "(", e.g. max().
1 parent ba75edd commit a53f2ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/quill/std/WideString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct Codec<T,
4848

4949
// The length is stored as uint32_t on the wire. Clamp before casting so a release
5050
// build cannot truncate-then-overflow when given a pathologically large string.
51-
constexpr size_t max_len = std::numeric_limits<uint32_t>::max();
51+
constexpr size_t max_len = (std::numeric_limits<uint32_t>::max)();
5252
QUILL_ASSERT(
5353
len <= max_len,
5454
"Wide string length exceeds uint32_t max in Codec<std::wstring>::compute_encoded_size()");

0 commit comments

Comments
 (0)