Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS2008: warning C4003 - min/max problem #1156

Closed
escherstair opened this issue Jan 9, 2018 · 5 comments
Closed

VS2008: warning C4003 - min/max problem #1156

escherstair opened this issue Jan 9, 2018 · 5 comments

Comments

@escherstair
Copy link
Contributor

The issue is exactly what is described here and here.
It seems that if I compile with VS2008 and <Windows.h> is included before <document.h>, a conflict between min and max macros arises.
The issue happens at lines 1008, 1014, 1015, 1032 and 1033 of <document.h> and can be fixed adding parentheses around the calls to std::numeric_limits<float>::max and std::numeric_limits<float>::min
I mean that line 1008 should be changed from
&& (d < static_cast<double>(std::numeric_limits<uint64_t>::max()))
to
&& (d < static_cast<double>((std::numeric_limits<uint64_t>::max)()))
and so on....

Could you implement this fix, please?

@chwarr
Copy link
Contributor

chwarr commented Jan 9, 2018

I'm pretty sure this has been fixed already in 6e38649 (and for the tests in e4c0ecf).

@escherstair
Copy link
Contributor Author

I see that you're right.
I've been using latest stable release v1.1.0 and so the fix hasn't been included yet.
Do you know if a new stable release will be released soon?
Otherwise I'll download the head of master branch

@chwarr
Copy link
Contributor

chwarr commented Jan 10, 2018

I can't give a definitive answer about when the next release will come out: I just contributed the min/max patches. There are some issues open about tagging a release:

@miloyip miloyip closed this as completed Feb 12, 2018
@sonal71
Copy link

sonal71 commented Jun 27, 2018

Found the same issue in reader.h line 1704
if (d > std::numeric_limits::max())

The solution in this thread fixed the issue.

Thank you!

@chwarr
Copy link
Contributor

chwarr commented Jun 27, 2018

It looks like a recent commit, 2ea4343, added some more uses of std::numeric_limits::max(). I've created PR #1302 to address these uses as well.

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

No branches or pull requests

4 participants