From: "Jan Beulich" Subject: Re: [PATCH] Document the current coding style conventions. Date: Fri, 16 Mar 2012 09:23:43 +0000 Message-ID: <4F6314AF0200007800078E48@nat28.tlf.novell.com> References: <1331746038-25892-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel , Dario Faggioli Cc: xen-devel@lists.xensource.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 15.03.12 at 19:23, Dario Faggioli wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, Mar 14, 2012 at 6:27 PM, David Vrabel wrote: >> >> +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.: >> + >> +if ( condition ) >> +{ >> + /* Do stuff. */ >> +} >> + >> > Would it be worth to cite what's the preferred style in case of > else/else if ? I guess something like the below? > > if ( xxx ) > { > zzz > } else { > yyy > } } else { >> +Braces should be omitted for blocks with a single statement. e.g., >> + >> +if ( condition ) >> + single_statement(); >> + >> > And what if the *then* branch has one statement and the *else* > has more (or vice versa)? if ( ... ) else { } or, respectively, if ( ... ) { } else would be my view on this. > Or is that too much of a nitpicking? :-) I'd say this should be taken as implicit from the other pieces. Jan > Thanks and Regards, > Dario > > - -- > <> (Raistlin Majere) > - --------------------------------------------------------------------------------------------------- > Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli > Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iEYEARECAAYFAk9iM28ACgkQk4XaBE3IOsSYgACeIFG4qzHBPHIzqPb7PdPkZZmm > 01YAoIakO0RrLJ0eVyB4NXXuoMDKIxAf > =4gCT > -----END PGP SIGNATURE----- > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel