Re: if() and trailing ;

2006-08-03 Thread Andreas Schwab
"Dave Korn" <[EMAIL PROTECTED]> writes: > How about > > if (condition) > assert (other_dependent_condition); > > compiled under NDEBUG? assert(...) is never empty. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nü

RE: if() and trailing ;

2006-08-03 Thread Dave Korn
On 01 August 2006 16:00, Andreas Schwab wrote: > Joe Buck <[EMAIL PROTECTED]> writes: > >> On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: >>> After a couple hours debugging code, I figured our an if() somewhere had >>> a trailing ; like this: >>> >>> if (memcmp(p

Re: if() and trailing ;

2006-08-02 Thread Denis Vlasenko
On Tuesday 01 August 2006 16:54, Gabriel Dos Reis wrote: > "Denis Vlasenko" <[EMAIL PROTECTED]> writes: > | if() > | (void)0; /* do nothing */ > | > | will make you happy. > > No, I'm not. I find it Very Silly. Do you prefer buggy code like this? | > > After a couple hours debugging code,

Re: if() and trailing ;

2006-08-02 Thread Thomas R. Truscott
> But it is common to have an empty action on a condition. You'll often > see code like if (condition) /* nothing */; Yes, the intent of the warning is catch people who stick a ; at the end of a line (out of habit) when there should not be one. That is what the warning should target,

Re: if() and trailing ;

2006-08-01 Thread Andreas Schwab
Joe Buck <[EMAIL PROTECTED]> writes: > On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: >> After a couple hours debugging code, I figured our an if() somewhere >> had a trailing ; like this: >> >> if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0); >>

Re: if() and trailing ;

2006-08-01 Thread Gabriel Dos Reis
"Denis Vlasenko" <[EMAIL PROTECTED]> writes: | On 7/30/06, Joe Buck <[EMAIL PROTECTED]> wrote: | > On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: | > > After a couple hours debugging code, I figured our an if() somewhere | > > had a trailing ; like this: | > > | > >

Re: if() and trailing ;

2006-08-01 Thread Denis Vlasenko
On 7/30/06, Joe Buck <[EMAIL PROTECTED]> wrote: On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: > After a couple hours debugging code, I figured our an if() somewhere > had a trailing ; like this: > > if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0); >

Re: if() and trailing ;

2006-07-31 Thread Kaveh R. Ghazi
> > -Wextra enables this warning, as documented. Not 100% sure it > > was there in 3.3. If not you might want a more recent compiler. > > Doesn't work with 3.3, unrecognized option `-Wextra' > But with 4.0.1 it does: > > test.c:2: warning: empty body in an if-statement > > Thanks! >

Re: if() and trailing ;

2006-07-29 Thread Joe Buck
On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: > After a couple hours debugging code, I figured our an if() somewhere > had a trailing ; like this: > > if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0); > continue; /* failed */ > > The cod

Re: if() and trailing ;

2006-07-29 Thread Simon Boulet
Hi Dale, On 29-Jul-06, at 8:25 PM, Dale Johannesen wrote: On Jul 29, 2006, at 4:33 PM, Simon Boulet wrote: Hi, After a couple hours debugging code, I figured our an if() somewhere had a trailing ; like this: if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0);

Re: if() and trailing ;

2006-07-29 Thread Dale Johannesen
On Jul 29, 2006, at 4:33 PM, Simon Boulet wrote: Hi, After a couple hours debugging code, I figured our an if() somewhere had a trailing ; like this: if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0); continue; /* failed */ The code above will alwa

if() and trailing ;

2006-07-29 Thread Simon Boulet
Hi, After a couple hours debugging code, I figured our an if() somewhere had a trailing ; like this: if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0); continue; /* failed */ The code above will always reach "continue" even when memcmp() == 0. I was