[libvirt] why we should use a mechanical indentation checker

Eric Blake eblake at redhat.com
Thu Apr 15 15:59:24 UTC 2010

On 04/15/2010 02:16 AM, Jim Meyering wrote:
> I introduced a bug with this supposedly-safe, no-semantic-change delta:
>     http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=b6719eab9e95c5daeeea85
> See if you can spot it.
> I am adding something like the following to coreutils' HACKING,
> and will add the equivalent (adjusting indentation/brace-positioning style
> in the examples) to libvirt's hacking.html.in, so if you object,
> speak up soon.

ACK, but...

> +Curly braces: use judiciously
> +=============================
> +Omit the curly braces around an "if", "while", "for" etc. body only when
> +that body occupies a single line.  In every other case we require the braces.
> +This ensures that it is trivially easy to identify a single-*statement* loop:
> +each has only one *line* in its body.
> +
> +For example, do not omit the curly braces even when the body is just a
> +single-line statement but with a preceding comment.
> +
> +Omitting braces with a single-line body is fine:

...make the same tweak on that second paragraph as you do based on my
comments for coreutils

Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100415/29fbea28/attachment-0001.sig>

More information about the libvir-list mailing list