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

From: Ragnar Hojland Espinosa (ragnar@ragnar-hojland.com)
Date: Wed Nov 21 2001 - 07:31:15 EST


On Wed, Nov 21, 2001 at 12:40:17PM +0000, vda wrote:
> Hi,
>
> Upon random browsing in the kernel tree I noticed in accel.c:
> *a++ = byte_rev[*a]
> which isn't 100% correct C AFAIK. At least Stroustrup in his C++ book
> warns that this kind of code has to be avoided.
> Wrote a script to catch similar things all over the tree (attached).

If you wanna do this type of cleanup, you can take it one step forward;
remember that the order of evaluation of foo and bar doesn't have to be
{foo => bar} so it can be {bar => foo} I hope gcc's behaviour doesn't
change under our feet.

        a = foo (i) + bar (j);

.. sprinkle some pointer arithmetic over there for fun ;)

-- 
____/|  Ragnar Højland      Freedom - Linux - OpenGL |    Brainbench MVP
\ o.O|  PGP94C4B2F0D27DE025BE2302C104B78C56 B72F0822 | for Unix Programming
 =(_)=  "Thou shalt not follow the NULL pointer for  | (www.brainbench.com)
   U     chaos and madness await thee at its end."
-
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:27 EST