"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ü
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
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,
> 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,
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);
>>
"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:
| > >
| > >
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);
>
> > -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!
>
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
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);
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
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
12 matches
Mail list logo