[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH 07/10] pseries: Clean up error handli
From: |
Eric Blake |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register() |
Date: |
Tue, 19 Jan 2016 21:53:38 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 01/19/2016 05:21 PM, Alexey Kardashevskiy wrote:
>> You could drop the redundant () while touching this, as in:
>
>
> Seriously? Why? I personally find it really annoying (but I stay silent)
> when people omit braces in cases like this.
>
>
>> assert(token >= RTAS_TOKEN_BASE && token < RTAS_TOKEN_MAX);
Because it's the prevailing style. I estimate that less than 10% of qemu
over-parenthesizes, mostly because && and || are well-known C operator
precedence:
$ git grep ' && ' | wc
6462 57034 482477
$ git grep ') && (' | wc
578 6151 48655
Of course, that's a rough estimate, as it has false positives on 'if
(foo() && (b || c))', and false negatives on conditionals where there is
a unary rather than binary operator on either side of &&; but I'm sure
you could write a Coccinelle script if you wanted more accurate counting.
But you are equally right that as long as HACKING doesn't document it,
and checkpatch.pl doesn't flag it, then you can over-parenthesize binary
arguments to the short-circuiting operators to your aesthetic tastes.
And for other operators, like '&' and '|', I definitely recommend the
parenthesis, particularly if you manage to trigger a gcc or clang
warning (in spite of the precedence being unambiguous) if you omit the
parenthesis.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-ppc] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, (continued)
- [Qemu-ppc] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, David Gibson, 2016/01/15
- Re: [Qemu-ppc] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, Alexey Kardashevskiy, 2016/01/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, David Gibson, 2016/01/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, Alexey Kardashevskiy, 2016/01/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, David Gibson, 2016/01/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, Alexey Kardashevskiy, 2016/01/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling, David Gibson, 2016/01/18
[Qemu-ppc] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2016/01/15
[Qemu-ppc] [PATCH 10/10] pseries: Clean up error reporting in htab migration functions, David Gibson, 2016/01/15
[Qemu-ppc] [PATCH 05/10] pseries: Cleanup error handling in spapr_vga_init(), David Gibson, 2016/01/15
[Qemu-ppc] [PATCH 06/10] pseries: Improve error handling in find_unknown_sysbus_device(), David Gibson, 2016/01/15