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

Re: [Xen-devel] [PATCH] Document the current coding style conventions.



-----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
}

> +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)?

Or is that too much of a nitpicking? :-)

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


 


Rackspace

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