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