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

Re: style question (was Re: [libvirt] patch: allow disk cache mode to be specified in a domain's xml definition.)



On Thu, Jan 29, 2009 at 10:48:36PM -0500, Dave Allan wrote:
> Jim Meyering wrote:
> >Finally, I moved a couple variable declarations
> >down (C99-style) to their points of first use.
> 
> I take it that the C++/C99 is the recommended style for all libvirt 
> code?  I generally haven't coded this way in the past (in fact I usually 
> compile with -Wdeclaration-after-statement), and not seeing anything in 
> HACKING about it, I continued to use the traditional style, but if this 
> way is what everyone's converging on, I'll change to it.

My preference is for declarations immediately after the start of a 
block. eg, at start of a function, or immediately at start of a
nested if / while. I don't like have declarations scattered elsewhere 
in the functions because it means you end up having to scan the entire
function body to find where variables are declared, instead of just
looking at the start of the code block you are in. The vast majority
of libvirt code works this way, so I'd rather stick with the traditional
style and cleanup the few places not in compliance.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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