
i found that , when int a = 2, b = 0 the expression max( (_1 - _2 - 4)( a, b ) , 0 ); should return 0, but return -2, why ? is it a bug in lambda?

On Wed, Dec 12, 2007 at 08:39:41PM +0800, Guo Xu wrote:
The following code: #include <boost/lambda/lambda.hpp> #include <iostream> int main( int, char ** ) { using namespace boost::lambda; int a = 2; int b = 0; std::cout << std::max( (_1 - _2 - 4 )( a, b ), 0 ) << std::endl; } outputs 0 on my system. Using Boost 1.34.1 and GCC 4.1.2. Check your version of std::max, and make sure it's not accidently macroed (e.g. when including windows.h). It could be a signed/unsigned issue. Also, please post (a minial example of) compilable code to the mailing list instead of code fragments. N.
participants (2)
-
Guo Xu
-
Niels Aan de Brugh