-
Notifications
You must be signed in to change notification settings - Fork 250
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
Convert min/max macros to std::min/max #23
Conversation
Is there a reason not to use std::min? numeric_limits::min is the minimum value a float can store, whereas std::min(a,b) is the lesser of the two numbers. |
Agree, would be better use std::min / std::max and get rid min / max macros altogether. In code there also |
That might just be the pre-processor replacing stuff where it should not. So far I only saw However, moving to |
Well, there need a casting into desired type. Since there anyway a lot of renaming, why don't go little further and use standardized functions? |
Renaming the macro was mostly done to get the code to compile, small steps :) Fully switching to Instead, maybe replace the macro with a custom |
You can specialize std::min like this:
IMO, that's the best way to do it. |
It is now templated where needed. |
@th1000s can you please rebase on master branch ? |
8ba8042
to
f73b156
Compare
Added explicit <float> or <int> template argument where needed. Add -DNOMINMAX define for Windows.
Convert min/max macros to std::min/max
Added explicit
<float>
or<int>
template argument where needed.Add
-DNOMINMAX
define for Windows.Commit message was:
These only cause trouble in stdlib headers, such as:
plus there is the whole NOMINMAX situation on Windows.
And don't introduce
<algorithm>
just for that.Automated via:
plus remove duplicates from lib/Macros.h + lib/linux/linux_fix.h and fix netgames/dmfc/dmfcstats.cpp (2x min on one line) manually.
Or, any other name, maybe just
min_
/max_
?