-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update min-max to GET_MIN-GET_MAX #3799
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
Conversation
|
To prevent |
|
@dotnet-bot test this please |
lib/Common/Core/CommonMinMax.h
Outdated
| template<class T> inline | ||
| _Post_equal_to_(a > b ? a : b) _Post_satisfies_(return >= a && return >= b) | ||
| const T& max(const T& a, const T& b) { return a > b ? a : b; } | ||
| const T& GET_MAX(const T& a, const T& b) { return a > b ? a : b; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the casing kind of implies that this is a macro. I feel like a GetMax or just Max would be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeHolman agree. I would gladly consider GetMax or Max at the first place. Well, such a large project + dependencies. GET_MAX is kinda different enough to define at global scale?
Updating the original definitions to GetM**Global and re-defining back as GET_M**
#define GET_MAX GetMaximumGlobal
#define GET_MIN GetMinimumGlobal
So, this should work for anyone is searching for define GET_MAX project wide
|
@obastemur There seems to be some issue with the win2k8 machines connected to the upgraded Jenkins (they don't support newer TLS versions). I'm seeing what I can do about it |
c3d20a9 to
434ea0d
Compare
|
@dotnet-bot test Windows 7 ci_dev12_x64_debug please |
|
@MikeHolman @digitalinfinity additional thoughts? |
|
@obastemur Curious, why Xcode undefs min/max forbids this project to use min/max? As you've seen we were using our own min/max functions in "CommonMinMax.h" and not affected by the macros? |
IMHO it's a good practice that they enforced this with latest xcode. It's not just
@jianchun I guess you missed Well, I could do the same on pal.h and trick the compiler hence keep using and.. |
|
IMO getting rid of the macro is a good thing; removing the paradigm is unnecessary. STL kept std::min/std::max. ChakraCore already had the solution in place -- |
|
@jianchun well, Otherwise, how is different Probably my comment wasn't clear but from the possible solutions, I picked using a unique name instead of tricking the compiler. If you have other name suggestion, go ahead!.. if you suggest that we may put max/min under a namespace, I'm also in.. |
|
Ref file : https://github.com/chapuni/libcxx/blob/master/include/__undef_min_max Once again, this is all about However, using this opportunity, I made |
|
@obastemur Again, ChakaCore had already solved the "bad macro" problem: "NOMINMAX" defined globally in Build props; replaced with "CommonMinMax.h" functions. Existing "CommonMinMax.h" was already preventing the macro -- would already be a build failure if the macro kicks in. Thus we need nothing to "trick" the compiler. The macro simply did not exist and were not allowed in ChakraCore already. My debate point is that the function names "min/max" are fine and no need to replace with custom ones. I think they are well known and better than custom ones. The custom ones make code slightly harder to read. That's a minor point and I'm not blocking this PR. |
|
@jianchun I'm also not happy with the size of change either (considering the mess I'm going to deal with during master branch merge conflicts)
I agree it doesn't on ChakraCore libs but it does on PAL. My question/concern is that
I do appreciate the discussion and |
What's your concern with global function min/max? (The macros are bad because they have side effects. Your quote |
|
@jianchun my concerns are 1 - we have bunch of However, I understand the overall concerns and agree with some of them. Well, the intention here is to fix the things. not break :) I will make the necessary PAL side changes only. updating the PR. Thanks for the discussion. |
jianchun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the discussion and update!
Merge pull request #3799 from obastemur:xcode9 Xcode9 undefs min-max.
Merge pull request #3799 from obastemur:xcode9 Xcode9 undefs min-max.
Xcode9 undefs min-max.