Closed
Description
Depending on the project that is consuming fmt{} (particularly Windows), min and max may be defined as macros, which causes compile errors in write_fractional_seconds. Specifically, lines 1056 and 1067:
int leading_zeroes = std::max(0, num_fractional_digits - num_digits);
leading_zeroes = std::min(leading_zeroes, precision);
While #undef'ng both min and max is one solution, this can break other compilation bits that still expect them to be defined.
A portable solution that doesn't resort to macro finagling is to explicitly use the data type:
int leading_zeroes = std::max(0, num_fractional_digits - num_digits);
leading_zeroes = std::min(leading_zeroes, precision);
Metadata
Metadata
Assignees
Labels
No labels