add parentheses around min and max#377
Conversation
|
Thanks for this. Did you just spot these or did you use an algorithm to find all cases of unprotected min/max? |
|
Thanks, these look all good. It is rediculous that Windows enforces this workaround on everyone. I don't like sprinkling the code with parenthesis because the reason is not clear unless you know about the Windows bug, but the only more obvious fix is incredibly verbose, so it is better this way. It is the technique used by Boost.Config. In ct width = max BOOST_PREVENT_MACRO_SUBSTITUTION (ct(1), |
|
@HDembinski Thank you for pointing out the standard way of doing the workaround. I was copying the test code into the beginning of So I global searched |
add parentheses around
minandmaxto suppress macro invocationhttps://stackoverflow.com/questions/6884093/warning-c4003-not-enough-actual-parameters-for-macro-max-visual-studio-2010
https://stackoverflow.com/questions/7449620/how-to-call-stdmin-when-min-has-been-defined-as-a-macro
https://stackoverflow.com/questions/22744262/cant-call-stdmax-because-minwindef-h-defines-max
https://stackoverflow.com/questions/11544073/how-do-i-deal-with-the-max-macro-in-windows-h-colliding-with-max-in-std