   crtdbg Assert
  I was wondering if someone could explain a little something to me about the crtdbg assert. This is the one I'm talking about:#define _ASSERT_EXPR(expr, msg)(void) ((!!(expr)) ||(1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, msg)) ||(_CrtDbgBreak(), 0))This must be a quirk of c++ that I don't know: How does (_CrtDbgBreak(), 0) turn into a conditional statement?   
Quote:Original post by M4573RThis must be a quirk of c++ that I don't know: How does (_CrtDbgBreak(), 0) turn into a conditional statement?It's the oft forgotten comma operator.  That assert code is just being fancy by avoiding explicit conditionals and taking advantage of short circuiting :)   ;  So both parts are evaluated in order, but the right side is used in the condition?On a side note: I've forgotten if expressions are always evaluated left right after order of operations. As an example, could this get you into trouble if a pointer is null depending on the compiler?: if( pointer && pointer->member )   ;Quote:Original post by M4573RSo both parts are evaluated in order, but the right side is used in the condition?Yes, the expressions are evaluated left to right, but the final type and value of the whole thing is that of the rightmost expression.  So "foo || (bar,0)" will evaluate to the same thing as "foo || 0" (or just "foo"), however if "foo" is false, "bar" will be evaluated.   ;  Man that is tricky business. That has got to be useful in a million places.   