[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 04/14] block/amend: separate amend and create options for
From: |
Eric Blake |
Subject: |
Re: [PATCH v6 04/14] block/amend: separate amend and create options for qemu-img |
Date: |
Fri, 15 May 2020 12:24:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 5/15/20 1:22 AM, Max Reitz wrote:
+ QCOW_COMMON_OPTIONS,
+ { /* end of list */ }
...the intended usage is to use the macro name followed by a comma, so
including a trailing comma in the macro itself would lead to a syntax
error.
But why is that the indended usage? Is there something in our coding
style that forbids macros that don’t allow a separator to be placed
after them?
If we have more than one such macro, it is easier to write and indent
(especially when using your editor's ability to decipher enough syntax
to suggest how to indent):
myarray = {
COMMON_ELEMENTS,
MORE_ELEMENTS,
{ /* end of list */ }
};
than it is:
myarray = {
COMMON_ELEMENTS
MORE_ELEMENTS
{ /* end of list */ }
};
which in turn implies that it is better to NOT stick a trailing comma in
the macro itself. Similarly, for macros intended to replace statements,
we tend to avoid the trailing ; in the macro itself, because it is
easier to read:
{
code;
MACRO();
more code;
}
than it is:
{
code;
MACRO()
more code;
}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[PATCH v6 05/14] block/amend: refactor qcow2 amend options, Maxim Levitsky, 2020/05/10
[PATCH v6 08/14] block/qcow2: extend qemu-img amend interface with crypto options, Maxim Levitsky, 2020/05/10
[PATCH v6 09/14] iotests: filter few more luks specific create options, Maxim Levitsky, 2020/05/10