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: <adabqi16v5a.fsf@cisco.com>
Date:	Fri, 06 Apr 2007 14:38:25 -0700
From:	Roland Dreier <rdreier@...co.com>
To:	David Brownell <david-b@...bell.net>
Cc:	Stefan Richter <stefanr@...6.in-berlin.de>,
	Jan Engelhardt <jengelh@...ux01.gwdg.de>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	Tony Lindgren <tony@...mide.com>, linux-kernel@...r.kernel.org
Subject: Re: coding style for long conditions

[I can't believe I'm stepping into an indentation flamewar, but here goes...]

 > Please change your coding style to conform to Documentation/CodingStyle.
 > 
 > 	***	Only indent with tabs!!		***
 > 
 > Every one of those examples violates that simple rule.

Yes, Documentation/CodingStyle says that we should only indent with
tabs.  However, that simple rule has to be interpreted with some
common sense, and the case of multi-line if conditions is definitely a
case where using only tabs makes code much less readable.

If you want an excuse, you could say that in code like

	if (foo___________ &&
	    bar___________) {
 		doit;

that the line with "bar" on it is properly indented with one tab
(since it is part of the if statement that is also indented one tab),
and then four spaces are used to align the "bar" with the previous
line.  So only tabs are used for indentation, and the spaces after the
tab are used for alignment, and the letter of the law is observed.

If you have a git tree handy, you can do "git show 68380b58" and see
that Linus himself wrote:

	if (get_wq_data(work) == cwq
	    && work_pending(work)
	    && !list_empty(&work->entry)) {

I have to admit that I would have put the &&s at the ends of the
previous lines rather than where Linus put them, but... egads!  Linus
put spaces before the &&s to line them up nicely!

"more in the breach" and all that I guess...

 - R.
-
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