Boost logo

Boost Users :

From: Chris Russell (cdr_at_[hidden])
Date: 2002-10-17 03:14:25


I'm confused. Using MS Visual Studio 6.0 w/the Intel 6.0 compiler (or the
native VC compiler for that matter) the min and max macros are defined in
the MS header WINDEF.H. It seems that config.hpp #undef's these (although I
haven't figured out where or why yet). My environment seems to be perfectly
happy using std::min/std::max. But what of all these MS-defined macros that
use the undecorated min/max? I really don't want to go chasing these down in
the MS + third-party headers if I can avoid it. Will someone please explain
to me what's going on with config.hpp?

- Thanks & regards
Chris Russell

--- simple example ---

#include <windows.h>
#include <boost/config.hpp>
#if defined(min)
#pragma message "min is defined"
#else
#pragma message "min not defined"
#endif
#if defined(max)
#pragma message "max is defined"
#else
#pragma message "max not defined"
#endif
int main(int argc, char* argv[])
{
int a = 10, b = 20; int c = min(a,b); int d = max(a,b);
return 0;
}

Deleting intermediate files and output files for project 'test - Win32
Debug'.
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
StdAfx.cpp
test.cpp
. . . Boost configuring for Intel C++ compiler
min not defined
max not defined
L:\boost\test\test.cpp(24): error: identifier "min" is undefined
   int c = min(a,b);
           ^
L:\boost\test\test.cpp(25): error: identifier "max" is undefined
   int d = max(a,b);
           ^
compilation aborted for L:\boost\test\test.cpp (code 2)
Error executing xicl6.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\test.sbr': No such file or
directory
Error executing bscmake.exe.

test.exe - 3 error(s), 0 warning(s)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net