[Lemon-devel] I can't believe
Alpár Jüttner
alpar at cs.elte.hu
Fri Apr 18 17:43:23 CEST 2008
Hi,
MSVC compiler complains about line
max_w=std::max(double(_arcWidths[e]),max_w);
in graph_to_eps.h saying that
C:\Work\lemon\cmake\lemon/graph_to_eps.h(748) : error C2589: '(' :
illegal token on right side of '::'
You won't believe the reason: There seems to exist a
#define max(a,b) (((a)>(b))?(a):(b))
line somewhere in the windows.h header file.
How to handle this situation? We use std::max in several places. In fact
it typically do not cause any problem because we don't use windows.h.
Even that special case can be solved if we move the windows.h dependent
stuff into a separate file including windows.h but not using std::max().
However this is still very dangerous, as a user of lemon can also
include windows.h.
Another 'nice' feature of MSVC:
In time_measure.h, will not compile the line
_os << _title;
but it compiles this:
_os << _title.c_str();
Yes, you see it right, MSVC does not allow you to push an std::string to
an std::ostream, but only a char *.
Regards,
Alpar
More information about the Lemon-devel
mailing list