From: malc <av1474@comtv.ru>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Kevin Wolf <kwolf@redhat.com>, Blue Swirl <blauwirbel@gmail.com>,
qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH] Drop braces around single statement rule
Date: Mon, 2 Aug 2010 20:06:46 +0400 (MSD) [thread overview]
Message-ID: <alpine.LNX.2.00.1008022005020.1676@linmac> (raw)
In-Reply-To: <4C56E8CB.1090104@codemonkey.ws>
On Mon, 2 Aug 2010, Anthony Liguori wrote:
> On 08/02/2010 10:41 AM, Kevin Wolf wrote:
> >
> > > But something like braces around an if doesn't seem like it creates a
> > > big problem. Most C programmers are used to seeing braces in some
> > > statements and not other. Therefore, it's hard to argue that the code
> > > gets really unreadable if this isn't strictly enforced.
> > >
> > I won't argue that missing braces impact readability of the code, they
> > probably don't. However, as was pointed out in earlier discussion there
> > still remain two important points:
> >
> > 1. While it doesn't make a difference for the code itself, readability
> > of patches suffers when braces have to be added/removed when a second
> > line is inserted or disappears.
> >
>
> I understand the argument but it's not something that I strongly agree with.
>
> > 2. I've messed up more than once with adding some debug code (even worse
> > when it happens with real code):
> >
> > if (foo)
> > fprintf(stderr, "debug msg\n");
> > bar(); /* oops, not conditional any more */
> >
>
> This is hard to do with editors that auto indent unless you're copying and
> pasting debugging. And yeah, I've made that mistake too doing the later :-)
>
> > This is why I tend to disagree with removing the rule, and suggest to
> > rather implement some automatic checks like Aurelien suggested (if we
> > need to change anything at all). I usually don't ask for a respin just
> > for braces if the patch is good otherwise, but if you think we should
> > just reject such patches without exceptions, I can change that.
> >
>
> Yeah, I try to remember to enforce it but often forget or just don't notice.
> My eyes don't tend to catch missing braces like they would catch bad type
> naming because the former is really not uncommon.
>
> I'm happy with the status quo but I won't object to a git commit hook that
> enforces style.
Seriously? You are happy with the situation where some people get their
patches rejected because they disagree/forogot/don't_care about single
statement braces while the patches of others make it through?
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2010-08-02 16:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-31 16:23 [Qemu-devel] [PATCH] Drop braces around single statement rule malc
2010-07-31 16:47 ` Aurelien Jarno
2010-07-31 16:51 ` Aurelien Jarno
2010-07-31 20:23 ` Blue Swirl
2010-07-31 20:35 ` malc
2010-07-31 23:49 ` Aurelien Jarno
2010-08-02 15:20 ` Anthony Liguori
2010-08-02 15:41 ` Kevin Wolf
2010-08-02 15:48 ` Anthony Liguori
2010-08-02 16:06 ` malc [this message]
2010-08-02 16:18 ` Anthony Liguori
2010-08-02 16:29 ` Blue Swirl
2010-08-02 16:32 ` Anthony Liguori
2010-08-02 15:55 ` malc
2010-08-02 16:04 ` Anthony Liguori
2010-08-02 16:24 ` Blue Swirl
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=alpine.LNX.2.00.1008022005020.1676@linmac \
--to=av1474@comtv.ru \
--cc=anthony@codemonkey.ws \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).