From: Avi Kivity Date: Mon, 25 Jul 2011 15:55:53 +0000 (+0300) Subject: CODING_STYLE: explicitly allow braceless 'else if' X-Git-Tag: TizenStudio_2.0_p2.3~2536^2~70 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b11887ad40df40dada4bf70b9c6702de386a8a87;p=sdk%2Femulator%2Fqemu.git CODING_STYLE: explicitly allow braceless 'else if' It's already allowed by the example; there are about 1800 instances in the tree; and disallowing it would lead to if (a) { ... } else { if (b) { ... } else { if (c) { ... } else { if (d) { ... } else { ... } } } } instead of if (a) { ... } else if (b) { ... } else if (c) { ... } else if (d) { ... } else { ... } which is more readable. Acked-by: Blue Swirl Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori --- diff --git a/CODING_STYLE b/CODING_STYLE index 5ecfa22..6e61c49 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -68,6 +68,10 @@ keyword. Example: printf("a was something else entirely.\n"); } +Note that 'else if' is considered a single statement; otherwise a long if/ +else if/else if/.../else sequence would need an indent for every else +statement. + An exception is the opening brace for a function; for reasons of tradition and clarity it comes on a line by itself: