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]
Date:	Fri, 04 May 2007 16:48:15 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	Oliver Neukum <oliver@...kum.org>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [patch]clarification of coding style regarding conditional statements
 with two branches

Oliver Neukum napsal(a):
> Hi,
> 
> I suggest that the coding style should state that if either branch of
> an 'if' statement needs braces, both branches should use them.
> 
> 	Regards
> 		Oliver
> Signed-off-by: Oliver Neukum <oneukum@...e.de>
> ----
> 
> --- a/Documentation/CodingStyle	2007-04-20 13:08:17.000000000 +0200
> +++ b/Documentation/CodingStyle	2007-04-20 13:16:14.000000000 +0200
> @@ -160,6 +160,21 @@
>  25-line terminal screens here), you have more empty lines to put
>  comments on.
>  
> +Do not unnecessarily use braces where a single statement will do.
> +
> +if (condition)
> +	action();
> +
> +This does not apply if one branch of a conditional statement is a single
> +statement. Use braces in both branches.

Why, what's wrong with
if (condition) {
	do_this();
	do_that();
} else
	otherwise();

? It's more readable/nicer in my eyes than

> +if (condition) {
> +	do_this();
> +	do_that();
> +} else {
> +	otherwise();
> +}
> +

and not only in mine according to fast grep.

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E
-
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