qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>,
	David Gibson <david@gibson.dropbear.id.au>,
	armbru@redhat.com
Cc: qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register()
Date: Tue, 19 Jan 2016 21:53:38 -0700	[thread overview]
Message-ID: <569F12D2.60307@redhat.com> (raw)
In-Reply-To: <569ED31D.1020307@ozlabs.ru>

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-01-20  4:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 12:00 [Qemu-devel] [PATCH 00/10] Cleanups to error reporting on ppc and spapr (v2) David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 01/10] ppc: Cleanup error handling in ppc_set_compat() David Gibson
2016-01-15 15:19   ` Markus Armbruster
2016-01-17  9:32     ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 02/10] pseries: Cleanup error handling of spapr_cpu_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling David Gibson
2016-01-18  2:44   ` Alexey Kardashevskiy
2016-01-18  4:42     ` David Gibson
2016-01-18  5:17       ` Alexey Kardashevskiy
2016-01-18  5:35         ` David Gibson
2016-01-18  6:04           ` Alexey Kardashevskiy
2016-01-18  8:17             ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 04/10] pseries: Clean up error handling in spapr_validate_node_memory() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 05/10] pseries: Cleanup error handling in spapr_vga_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 06/10] pseries: Improve error handling in find_unknown_sysbus_device() David Gibson
2016-01-15 15:40   ` Markus Armbruster
2016-01-18  2:50     ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register() David Gibson
2016-01-19 22:58   ` Eric Blake
2016-01-20  0:21     ` Alexey Kardashevskiy
2016-01-20  4:53       ` Eric Blake [this message]
2016-01-20  5:53         ` Alexey Kardashevskiy
2016-01-20 10:08           ` Thomas Huth
2016-01-20  7:18         ` Markus Armbruster
2016-01-20  8:15           ` Alexey Kardashevskiy
2016-01-20  9:27             ` Markus Armbruster
2016-01-15 12:00 ` [Qemu-devel] [PATCH 08/10] pseries: Clean up error handling in xics_system_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 09/10] pseries: Clean up error reporting in ppc_spapr_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 10/10] pseries: Clean up error reporting in htab migration functions David Gibson
2016-01-15 15:47 ` [Qemu-devel] [PATCH 00/10] Cleanups to error reporting on ppc and spapr (v2) Markus Armbruster
2016-01-16 13:15   ` David Gibson
2016-01-17 23:56   ` Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569F12D2.60307@redhat.com \
    --to=eblake@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).