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
(
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/20377/focus=20380).
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org