numeric_limits::max() vs windows.h

hey... im writing on a project which includes <windows.h> and <limits> for numeric_limits...

but when i want to do:
cin.ignore(numeric_limits::max());
it resolves ::max() to the max(a,b)-Macro defined in windows.h so i have to give it 2 parameters... but thats not waht i want...

any suggestions?...
Last edited on
#undef max will remove that macro
yeah... I had that problem to. Just undef them:

1
2
3
4
5
6
7
8
#include <windows.h>

#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif 
There is also a define I think it is:

#define NO_MIN_MAX that prevents windows from dong that.
I prefer #undefining than #defining new macros
Last edited on
windows.h predates C++ in the Microsoft world by many years. It is the only file you need to include to get all the junk you need for Windows GUI programming.

The guys at Microsoft recognised this and added a set of switches you can define to turn off parts of it, the most generally useful being WIN32_LEAN_AND_MEAN. Anyway, defining NOMINMAX is the recomended way of switching off min/max macros.
Last edited on
thx... i´ll use NOMINMAX...

anyone knows what "Kanji" is?... ther is an macro NOKANJI

:from windows.h :
NOKANJI - Kanji support stuff.
"Kanji" is Japanese for "Chinese Character(s)". It is for Shift-JIS support and the like. You probably don't need it.
Topic archived. No new replies allowed.