qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/1] block migration: fix return value mismatch


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/1] block migration: fix return value mismatch
Date: Thu, 13 Nov 2014 10:03:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/13/2014 09:44 AM, Gary Hook wrote:

[metacomment]

> On 11/13/14, 6:46 AM, "Markus Armbruster" 
> <address@hidden<mailto:address@hidden>> wrote:
> 
> Stefan Hajnoczi <address@hidden<mailto:address@hidden>> writes:
> 
> On Wed, Nov 12, 2014 at 06:48:18PM +0000, Gary Hook wrote:

Your quoting style leaves a lot to be desired.  While you correctly
attributed multiple contributors of the material quoted below...

> -    return qemu_ftell(f) - last_ftell;
> +    delta_ftell = qemu_ftell(f) - last_ftell;
> +    return( (delta_ftell > 0) ? 1 : (delta_ftell < 0) ? -1 : 0 );
> 
> Good find!
> 
> Please don't nest the ternary operator, it is hard to read.
> 
> if (delta_ftell < 0) {
>      return -1;
> } else if (delta_ftell > 0) {
>      return 1;
> } else {
>      return 0;
> }
> 
> Bah, that's for wimps ;)
> 
>     return (delta_ftell > 0) - (delta_ftell < 0);
> 
> Look ma, no branches!
> 
> Ha-ha! Very good, but even less readable than the compressed ternary version,
> IMO. This function only gets called once per migration; I don't see a few 
> branches as performance-critical and worth the sacrifice of clarity as to 
> intent.

...all three sets of contributions were listed with NO differentiation
in indentation or leading '>' or other indication which part was quoted
vs. which part was new material from you.  Most people on this list use
a REAL mail agent (such as mutt or Thunderbird), and avoid web mail,
precisely because most web mail implementations are absolutely lousy at
writing decently threaded conversations.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]