qemu-trivial
[Top][All Lists]
Advanced

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

Re: [PATCH v2 3/8] migration: Add spaces around operator


From: Bihong Yu
Subject: Re: [PATCH v2 3/8] migration: Add spaces around operator
Date: Mon, 19 Oct 2020 17:43:36 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Yes, I used to think "const VMStateDescription *[]" was right, but when I search
similar expressions, most of all are "xxx * []". Such as:
fsdev/qemu-fsdev.c:54:        .opts = (const char * [])
hw/intc/s390_flic_kvm.c:567:    .subsections = (const VMStateDescription * [])
...

So, I keep the same style. Should I change it to "const VMStateDescription *[]"?

On 2020/10/19 16:24, Markus Armbruster wrote:
> "Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:
> 
>> * Bihong Yu (yubihong@huawei.com) wrote:
>>> Signed-off-by: Bihong Yu <yubihong@huawei.com>
>>> Reviewed-by: Chuan Zheng <zhengchuan@huawei.com>
>>
>> Yes that's OK, I'm a bit sturprised we need the space afte rthe * in the
>> VMStateDescription case, I wouldn't necessarily go and change them all.
> 
> We don't: it's not the binary multiplication operator *, where we want a
> space on both sides, it's a pointer declarator, where we want a space on
> the left only.
> 
> Example:
> 
>     int *pa, *pb, *pc;
>     *pa = *pb * *pc;
> 
> Note the space on both side of binary operator * (multiplication), but
> only on the left side of the pointer declarator's * and the unary
> operator * (indirection).
> 
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> [...]
>>> diff --git a/migration/savevm.c b/migration/savevm.c
>>> index d2e141f..9e95df1 100644
>>> --- a/migration/savevm.c
>>> +++ b/migration/savevm.c
>>> @@ -521,7 +521,7 @@ static const VMStateDescription vmstate_configuration = 
>>> {
>>>          VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),
>>>          VMSTATE_END_OF_LIST()
>>>      },
>>> -    .subsections = (const VMStateDescription*[]) {
>>> +    .subsections = (const VMStateDescription * []) {
>>>          &vmstate_target_page_bits,
>>>          &vmstate_capabilites,
>>>          &vmstate_uuid,
> 
> Should be
> 
>    .subsections = (const VMStateDescription *[]) {
> 
> [...]
> 
> .
> 



reply via email to

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