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

[Xen-devel] [PATCH 2/2] CODING_STYLE: list further brace placement exceptions


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Fri, 19 Jul 2019 09:19:02 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eh5fJyr96BwL7NmKrJgjTloQpCJzgn1wF8ZNuZ6dMnw=; b=Dc9SwMhVDHw17M1rD4upZQFD+K0gQhVW58gfSbTXiefxin10JhngoBE27xucupUlnimfHjXn9PwIZUrws30eqF+3toSd/sAYCNYa+f+T9DRm706Nq7zWh1UpixoQOQIcJNPwPrTHojV1KIgQeH+93nJXfUFbtWN3HrRbjK0/hRle5YNAWOB63IAcPLvvXHUlSwVT9IHfhiH7f6UJ0p6m2qUjvb3sS3IqEsV7jl9avqpo+QR/5ycoslMPBflCJ1AwwxKwr5u+RQDBuGKcgI3o5Uht3EJPNW85FWBpQ1IGvtxfBUufP2dKUX1Wf2z+RnkmQ+2H21pAkxRTJnS8Mvvvjw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayu/VMPMBNoVRXNRb7nT0izwMeQGN6aFR34BuBkVljaSZzW6UkqyF6Rx091lbNQSTzTagKBuBQuz9U9BWJYyq0jcHye/yWEzT1NEpqO07yhTyoSWzW+v1ougLKlCm6JcByWv8YSDStkMjRj0AWmqdHtXGvFgGHDe0xbooGVfNEvsWO9bt+gPriu/KYu5y6xz6LKM+9FTMVSm8OPh8ffBe5f8TUK/2wMjMXADWECUyKmeBZA2be4QwSHCUheQNPriM+MLFvytsp/gZq3tC6ag4rJQJEQrBVb2antjDQcKb6sEAxCMLBBe6apADBOotPBnnx3ibEJnQZN3brJEFN4DYg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, JulienGrall <julien.grall@xxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxx>
  • Delivery-date: Fri, 19 Jul 2019 09:20:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVPhMBr+RUGGWe+UK6rQHc+fBEZA==
  • Thread-topic: [PATCH 2/2] CODING_STYLE: list further brace placement exceptions

For easy spotting of struct/union/enum definitions we already commonly
place the opening braces on the initial line of such a definition.

We also often don't place the opening brace of an initializer on a
separate line.

And finally for compound literals placing the braces on separate lines
often makes the code more difficult to read, so it should (and in
practice does) typically go on the same line as well.  The placement of
the closing brace often depends on how large such a compound literal is.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
TBD: We may want to make explicit that for initializers both forms are
      fine.

--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -64,8 +64,13 @@ Bracing
  -------
  
  Braces ('{' and '}') are usually placed on a line of their own, except
-for the do/while loop.  This is unlike the Linux coding style and
-unlike K&R.  do/while loops are an exception. e.g.:
+for
+- the do/while loop
+- the opening brace in definitions of enum, struct, and union
+- the opening brace in initializers
+- compound literals
+This is unlike the Linux coding style and unlike K&R.  do/while loops
+are one exception. e.g.:
  
  if ( condition )
  {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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