qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Document Qemu coding style


From: M. Warner Losh
Subject: Re: [Qemu-devel] [PATCH] Document Qemu coding style
Date: Mon, 30 Mar 2009 16:15:14 -0600 (MDT)

In message: <address@hidden>
            address@hidden (Lennart Sorensen) writes:
: On Mon, Mar 30, 2009 at 10:54:58PM +0300, Avi Kivity wrote:
: > Blue Swirl wrote:
: >>>  +4. Block structure
: >>>  +
: >>>  +Every indented statement is braced; even if the block contains just one
: >>>  +statement.
: >>>     
: >>
: >> I'd remove this, braces are not used consistently for one statement blocks.
: >>
: >>   
: >
: > While that's true, I'd like to keep this.  I found (after initially  
: > being annoyed by this; I dislike punctuation) that it's nice not to need  
: > to rebrace after adding or removing lines.
: 
: I hate having to add braces to add a printf when debuging something.
: If you forget the braces, you change the meaning of the code.  To me
: that's a disaster and enough reason that leaving out braces should
: be banned.  Code style that encourages creation of bugs is bad style.
: Surprisingly many code styles don't get this however.

With editors like emacs, this isn't an issue.

: I also like consistency, and since you need braces for multiline
: statements, why not always use them?

Because it stretches the code vertically.  More extra useless 'blank'
lines makes it harder to get more code on the screen, which makes the
code harder to understand.

Anyway, this is a highly religious issue.  Either you think that {}
are the bee's knees and people are morons that don't use them, or you
hate them with a huge passion and can't believe people are stupid
enough to require it.  There's a very small set of folks in between,
and often little common ground: usually one camp tolerates the
practices of the other...

Warner




reply via email to

[Prev in Thread] Current Thread [Next in Thread]