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: Lennart Sorensen
Subject: Re: [Qemu-devel] [PATCH] Document Qemu coding style
Date: Mon, 30 Mar 2009 17:43:22 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

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.

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

-- 
Len Sorensen




reply via email to

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