why( warning: left-hand operand of comma expression has no effect)

Zsbán Ambrus ambrus at math.bme.hu
Mon Dec 3 16:44:22 CET 2012


On 11/26/12, Sam Bobroff <sbobroff at shoretel.com> wrote:
> Your suggestion of changing the comma operator to "&&" seems like a good
> solution to me too but personally, as I sort of explained before, I
> would use a more direct approach: assert() takes one argument and I want
> it to take two, so I'd write my own function. Something like this:
>
> #define ASSERT(SCALAR,MSG) assert2(__FILE__, __LINE__, #SCALAR,
> (SCALAR), (MSG))
>
> void assert2(const char *file, int line, const char *expr_string, int
> expr_val, const char *msg) {

So wait, you just want something like the BOOST_ASSERT_MSG macro,
except with an implementation that works in C as well as C++?  See
http://www.boost.org/doc/libs/1_52_0/libs/utility/assert.html .

Ambrus



More information about the libev mailing list