[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt;



commit 9ee1d0395576283b24c87f8d5ec7bb123cadc27c
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Mon Aug 8 11:21:31 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon Aug 8 11:52:02 2016 +0100

    libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt;
    
    And clarify that the rule about omitting braces for single statements
    is optional (it is even contradicted by the example).
    
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/CODING_STYLE | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/CODING_STYLE b/tools/libxl/CODING_STYLE
index 01ee25b..32170ef 100644
--- a/tools/libxl/CODING_STYLE
+++ b/tools/libxl/CODING_STYLE
@@ -294,8 +294,10 @@ Libxenlight coding style is super simple.  Avoid tricky 
expressions.
 
 5. Block structure
 
-Every indented statement is braced, except blocks that contain just
-one statement.
+Every indented statement is braced, but blocks that contain just one
+statement may have the braces omitted.  To avoid confusion, either all
+the blocks in an if...else chain have braces, or none of them do.
+
 The opening brace is on the line that contains the control flow
 statement that introduces the new block; the closing brace is on the
 same line as the else keyword, or on a line by itself if there is no
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.