[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions |
Date: |
Wed, 06 Aug 2014 08:05:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
"Gonglei (Arei)" <address@hidden> writes:
> Hi,
>
>> >
>> > $WHATEVER: don't use 'Yoda conditions'
>> >
>> > 'Yoda conditions' are not part of idiomatic QEMU coding
>> > style, so rewrite them in the more usual order.
>>
>>
>> OK but why stop at these files? How about this
>> instead?
>>
> I just search c files by using key words like "NULL ==" etc.
>
> I don't think we should change conditional statements like ">" and ">=".
Eric pointed out it's actually incorrect for NaNs.
If you want to touch inequalities, separate patch(es) please, because
they need more thorough review, both for correctness and for style.
> BTW, just using like "value == NULL" instead of "NULL == value" in all files
> is not a good idea, which we have discussed in my patch serials v2. So, I
> posted
> v3, add change log " imitate nearby code about using '!value' or
> value == NULL' at
> every patch " .
Re "not a good idea": I think rewriting "NULL == value" to "value ==
NULL" *is* a good idea, but rewriting it to "!value" where that blends
in with surrounding code is a *better* idea.
Gonglei's patches do that, Michael's don't, but are more complete.
Therefore:
> So, maybe you can post patches for those files I have missed in the serials,
> but not simply instead all by semantic script IMO, thanks!
Easy: apply Gonglei's patches before you run the script.
You may have to split patches along subsystem boundaries to get them in.
Bothersome, as it involves guessing boundaries. Not a request from me,
just a warning of possible misfortune :)
- Re: [Qemu-devel] [PATCH v3 1/8] CODING_STYLE: Section about conditional statement, (continued)
[Qemu-devel] [PATCH v3 3/8] audio: don't use 'Yoda conditions', arei.gonglei, 2014/08/01
[Qemu-devel] [PATCH v3 6/8] spice: don't use 'Yoda conditions', arei.gonglei, 2014/08/01
[Qemu-devel] [PATCH v3 7/8] vl: don't use 'Yoda conditions', arei.gonglei, 2014/08/01
[Qemu-devel] [PATCH v3 2/8] usb: don't use 'Yoda conditions', arei.gonglei, 2014/08/01
[Qemu-devel] [PATCH v3 4/8] isa-bus: don't use 'Yoda conditions', arei.gonglei, 2014/08/01
Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions, Michael S. Tsirkin, 2014/08/05
Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions, Eric Blake, 2014/08/05