Re: [BUG] Bad #define, nonportable C, missing {}

From: Chris Gray (cgray4@cs.mcgill.ca)
Date: Thu Nov 22 2001 - 15:43:15 EST


On Wed, 21 Nov 2001, Vincent Sweeney wrote:
>>
>> drivers/block/paride/pf.c: if (l==0x20) j--; targ[j]=0;
>> drivers/block/paride/pg.c: if (l==0x20) j--; targ[j]=0;
>> drivers/block/paride/pt.c: if (l==0x20) j--; targ[j]=0;
>> (these files need Lindenting too)
>> ----------
>> Missing {} Either a bug or a very bad style (so bad that I can even
>> imagine that it is NOT a bug). Please double check before applying
>> the patch! -- vda
>
> C std says IFF you have one expression after the for() then you can
> omit the {}'s. So this is NOT a bug or bad coding style its just
> saving some bytes in the source code :)

The point here is that what is written as

if(l==0x20) j--; targ[j]=0;

is actually

if(l==0x20)
        j--;
targ[j]=0;

and not the

if(l==0x20){
        j--;
        targ[j] = 0;
}

that it appears to be. I wouldn't like to use 'l' as a variable
either, but that's just me.

Cheers,
Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 23 2001 - 21:00:31 EST