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: <467AC8E9.1000605@goop.org>
Date:	Thu, 21 Jun 2007 11:52:25 -0700
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Jesper Juhl <jesper.juhl@...il.com>
CC:	Cyrill Gorcunov <gorcunov@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bracing the loop in kernel/softirq.c

Jesper Juhl wrote:
> On 20/06/07, Cyrill Gorcunov <gorcunov@...il.com> wrote:
>> This trivial patch adds braces over a one-line
>> loop. That makes code...well... little bit
>> convenient for (possible) further modifications.
>>
> That's generally not done.
>
> It's even in Documentation/CodingStyle :
>
> "
> Do not unnecessarily use braces where a single statement will do.
>
> if (condition)
>        action();
> "

I tend to see "do {} while()" as an exception to this.  I find the 
construct is sufficiently rare that it helps to emphasize it a bit.  For 
example if I'm scanning code and I see:

	while (foo != NULL);

in the corner of my eye, I'm going to think "huh?".  But:

	} while (foo != NULL);

visually "parses" properly, regardless of how near or far the 
corresponding "do  {" is.

(And of course, its consistent with the super extra special while-while 
loop:

	while (foo != NULL) {
		foo = bar();
		piffle();
	} while (foo != NULL);	// make sure we loop properly

;)

    J
-
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