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

2012-12-03 Thread Zsbán Ambrus
On 11/26/12, Sam Bobroff sbobr...@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

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

2012-11-25 Thread Jonathan Neuschäfer
On Sat, Nov 24, 2012 at 06:50:53PM -0800, Colin McCabe wrote: I do think it would make sense to replace that: assert(foo was 0, foo) ; assert((foo was 0, foo)); /* mind the parentheses */ with: assert(foo was 0 foo); The latter doesn't produce any gcc warnings for me, whereas the former

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

2012-11-25 Thread Sam Bobroff
On 25/11/12 13:50, Colin McCabe wrote: On Tue, Nov 20, 2012 at 2:17 PM, Sam Bobroff sbobr...@shoretel.com wrote: On 20/11/12 21:34, Marc Lehmann wrote: On Tue, Nov 20, 2012 at 02:54:50AM +, Sam Bobroff sbobr...@shoretel.com wrote: Sorry if you felt that I'd disrespected your code, that

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

2012-11-24 Thread Colin McCabe
On Tue, Nov 20, 2012 at 2:17 PM, Sam Bobroff sbobr...@shoretel.com wrote: On 20/11/12 21:34, Marc Lehmann wrote: On Tue, Nov 20, 2012 at 02:54:50AM +, Sam Bobroff sbobr...@shoretel.com wrote: Sorry if you felt that I'd disrespected your code, that wasn't my A hack is something that

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

2012-11-20 Thread Marc Lehmann
On Tue, Nov 20, 2012 at 02:54:50AM +, Sam Bobroff sbobr...@shoretel.com wrote: Sorry if you felt that I'd disrespected your code, that wasn't my A hack is something that happens to work, but is not well done. This use of assert is part of the C language that is well supported and in

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

2012-11-20 Thread Alex Leone
I tend to use with the string literal: assert (libev: watcher has invalid priority ABSPRI (w) = 0 ABSPRI (w) NUMPRI); On Tue, Nov 20, 2012 at 2:34 AM, Marc Lehmann schm...@schmorp.de wrote: On Tue, Nov 20, 2012 at 02:54:50AM +, Sam Bobroff sbobr...@shoretel.com wrote: Sorry if you

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

2012-11-20 Thread Sam Bobroff
On 20/11/12 21:34, Marc Lehmann wrote: On Tue, Nov 20, 2012 at 02:54:50AM +, Sam Bobroff sbobr...@shoretel.com wrote: Sorry if you felt that I'd disrespected your code, that wasn't my A hack is something that happens to work, but is not well done. This use of assert is part of the C

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

2012-11-19 Thread Colin McCabe
You might be able to silence this with __attribute__((unused)), at least for GCC and llvm. Or possibly by making assert a multi-argument macro... Colin On Fri, Nov 16, 2012 at 4:09 AM, Yoran Heling i...@yorhel.nl wrote: On 2012-11-16, SmallAnt wrote: i embed libev in my program,when

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

2012-11-19 Thread Marc Lehmann
On Mon, Nov 19, 2012 at 10:20:44AM -0800, Colin McCabe cmcc...@alumni.cmu.edu wrote: You might be able to silence this with __attribute__((unused)), at is only defined for variables and functions. least for GCC and llvm. Or possibly by making assert a multi-argument macro... macros can't

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

2012-11-19 Thread Sam Bobroff
On 16/11/12 23:09, Yoran Heling wrote: [snip] Just look at the source: assert ((libev: watcher has invalid priority, ABSPRI (w) = 0 ABSPRI (w) NUMPRI)); The string has absolutely no effect to the behaviour of the code, so the warning makes sense. However, that string *is* quite useful

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

2012-11-19 Thread Marc Lehmann
On Tue, Nov 20, 2012 at 01:16:04AM +, Sam Bobroff sbobr...@shoretel.com wrote: Maybe those hack strings should removed from the assert calls and be moved into comments in the code? Calling this a hack just shows your immaturity in the C language - not everything that is new to you is badly

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

2012-11-19 Thread Sam Bobroff
On 20/11/12 12:32, Marc Lehmann wrote: On Tue, Nov 20, 2012 at 01:16:04AM +, Sam Bobroff sbobr...@shoretel.com wrote: Maybe those hack strings should removed from the assert calls and be moved into comments in the code? Calling this a hack just shows your immaturity in the C language -

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

2012-11-16 Thread SmallAnt
i embed libev in my program,when compile,there are warnings: /// ./libev/ev_poll.c: In function `poll_poll': ./libev/ev_poll.c:110: warning: left-hand operand of comma expression has no effect In file included from ohc_ev.c:7: ./libev/ev.c: In function `verify_watcher': ./libev/ev.c:2504: warning: