lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0609301329230.3952@g5.osdl.org>
Date:	Sat, 30 Sep 2006 13:43:44 -0700 (PDT)
From:	Linus Torvalds <torvalds@...l.org>
To:	Andi Kleen <ak@...e.de>, Jan Beulich <jbeulich@...ell.com>
cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...e.hu>, Andrew Morton <akpm@...l.org>,
	nagar@...son.ibm.com, Chandra Seetharaman <sekharan@...ibm.com>,
	Eric Rannaud <eric.rannaud@...il.com>
Subject: Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)



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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ