[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] Document the current coding style conventions.
>>> On 15.03.12 at 19:23, Dario Faggioli <raistlin@xxxxxxxx> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, Mar 14, 2012 at 6:27 PM, David Vrabel <david.vrabel@xxxxxxxxxx> 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 ( ... ) <statement> else { <statements> } or, respectively, if ( ... ) { <statements> } else <statement> 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 > > - -- > <<This happens because I choose it to happen!>> (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@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |