Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- From: Linus Torvalds <torvalds@xxxxxxxx>
- Date: Sat, 30 Sep 2006 13:43:44 -0700 (PDT)
On Sat, 30 Sep 2006, Linus Torvalds wrote:
It's not just unreadable and obviously buggy, it's so scarily that it's
hard to even talk about it. Lookie here:
#define HANDLE_STACK(cond) \
do while (cond) { \
unsigned long addr = *stack++; \
What the F*CK! "do while(cond) {" ????
Btw, it took me quite a while to realize how something like that can
even compile. Seriously. Don't write code like that. Maybe some humans
parse it as
do {
while (cond) {
..
}
} while(0)
(which is the technically correct parsing and explains why it compiles
and wors), but I suspect I'm not the only one who went "What the F*CK"
when shown it without the "extraneous" braces.
For similar reasons, we write
#define dummy(x) do { } while (0)
rather than the shorter
#define dummy(x) do ; while (0)
(which some people _do_ seem to use. Aarggh!)
Or at least indent it. Or something.
I'll see if I can make git warn about "do <non-blockstatement> while ()",
if only because I at least personally seem to have trouble parsing it.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- From: Eric Rannaud
- Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- From: Linus Torvalds
- BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- Prev by Date: Young Ladies so outshine and kind!
- Next by Date: Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- Previous by thread: Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- Next by thread: Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
- Index(es):