4 ms·
> min and max are names I had used for variables and functions all over the place Shadowing is better than the very questionable decisions made by whoever wrot
by delta_p_delta_x 2y ago
> min and max are names I had used for variables and functions all over the place
Shadowing is better than the very questionable decisions made by whoever wrote Windows.h...
#include <Windows.h>
#define NOMINMAX // comment out to break
#include <algorithm>
auto main() -> int
{
return std::min(42, 1337); // may break
}
- eska 2y agoThe windows headers are so convoluted and huge that I just copy the necessary declarations into my own mini header. It’s a bit annoying at first but saves a lot of headache later.
- mococa 2y agoThis one made me lose a few strands of hair years ago.
- BearOso 2y agoNOMINMAX is checked in windows.h to control whether it adds the macros. It needs to be defined before the inclusion.