From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
Konrad Wilk <konrad.wilk@oracle.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>, JulienGrall <julien.grall@arm.com>,
Ian Jackson <ian.jackson@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [Xen-devel] [PATCH 2/2] CODING_STYLE: list further brace placement exceptions
Date: Fri, 19 Jul 2019 16:48:06 +0000 [thread overview]
Message-ID: <877e8e2coq.fsf@epam.com> (raw)
In-Reply-To: <29b489fe-d7ad-68b8-b555-2a6381a28829@suse.com>
Hi Jan,
Jan Beulich writes:
> 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@suse.com>
> ---
> 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
Looks like this leaves us only with "if/else", "for", "switch" and
various forms of "for_each_*". So maybe it is worth to rewrite this
in the opposite manner? Like this:
Braces ('{' and '}') are usually placed on the same line, except the
following cases:
- if, else, for, switch statements
- for_each_* iterators like for_each_vcpu
> +This is unlike the Linux coding style and unlike K&R. do/while loops
There is extra space before "do/while".
> +are one exception. e.g.:
>
> if ( condition )
> {
>
--
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-07-19 16:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 9:15 [Xen-devel] [PATCH 0/2] ./CODING_STYLE adjustments Jan Beulich
2019-07-19 9:18 ` [Xen-devel] [PATCH 1/2 RESEND] CODING_STYLE: explicitly call out label indentation Jan Beulich
2019-07-19 13:18 ` Tamas K Lengyel
2019-07-19 13:21 ` Jan Beulich
2019-07-19 13:28 ` Tamas K Lengyel
2022-11-29 20:54 ` Stefano Stabellini
2019-07-19 9:19 ` [Xen-devel] [PATCH 2/2] CODING_STYLE: list further brace placement exceptions Jan Beulich
2019-07-19 16:48 ` Volodymyr Babchuk [this message]
2019-07-22 8:14 ` Jan Beulich
2022-11-29 20:54 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877e8e2coq.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.