Re: Kernel bugs found using inspect tool

From: Stephen Satchell (satch@concentric.net)
Date: Wed Feb 23 2000 - 17:37:45 EST


At 07:57 AM 2/23/00 , Jamie Lokier <lk@tantalophile.demon.co.uk> wrote:
> > > if (foo);
> > > bar;
> >
> > Those are perfectly legal constructions. The compiler, while certainly
> > magic, isn't a psychic.
>
>Yes they are legal. And in every case where I've seen them, they're a
>mistake. The semicolon ones are good at being invisible too. I've
>done it and spent hours not seeing the semicolon in my code. Of course
>it's easy to see in someone else's code... :-)
>
>And yes, I've seen kernel patches fixing these bugs from time to time.

I get burned on this from time to time, especially after working on PL/I
code. In my programs, I have a style rule that says that an empty
statement of a for, while, do, or if statement must be coded as {} in order
to show that the set of instructions to execute is empty. (I also have the
style rule that EVERY for, while, do, or if statement must have the object
instruction(s) enclosed in braces -- I got this from Plauger's book and it
has helped immensely.)

I'm looking at "indent" to see if it can recognize empty statements and
convert the lone semicolon to {} so that this sort of thing becomes more
obvious.

Linus would probably hate that...

Satch

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



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:34 EST