Skip to content

Work around Windows min/max macro problem - #145

Merged
henryiii merged 2 commits into
CLIUtils:masterfrom
dvj:win-macro
Jul 6, 2018
Merged

henryiii merged 2 commits into
CLIUtils:masterfrom
dvj:win-macro

Conversation

@dvj

@dvj dvj commented Jul 6, 2018

Copy link
Copy Markdown
Contributor

This small change works around the very problematic default feature of windows.h declaring macros for min and max. See https://stackoverflow.com/questions/5004858/stdmin-gives-error

There are other solutions to this problem (Such as defining #NOMINMAX on the project developer's side), but this change keeps the code in CLI11 unambiguous.

This would mean that any further invocations of std::min or std::max in this project would also need to use the explicit template type version for this change to be useful. I would understand if you do not wish to do that. If you do think it is worthwhile, a test could also be created that includes windows.h such that the macros would be defined and cause errors when building on Windows if min or max is used ambiguously in the future.

@codecov

codecov Bot commented Jul 6, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #145 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #145   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1691   1691           
=====================================
  Hits         1691   1691
Impacted Files Coverage Δ
include/CLI/Option.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20c304f...1a6177f. Read the comment docs.

@henryiii
henryiii merged commit f6e1b8d into CLIUtils:master Jul 6, 2018
@henryiii

henryiii commented Jul 6, 2018

Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants