[Top][All Lists]

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

Re: [Qemu-devel] [PATCH RFC v2 26/47] qapi-types: Convert to QAPISchemaV

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v2 26/47] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions
Date: Wed, 22 Jul 2015 14:07:26 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/22/2015 11:34 AM, Eric Blake wrote:

> -typedef struct int32List {
> +typedef struct boolList boolList;
> +
> +struct boolList {
> I can understand the minor change in #ifdef name, and even the
> separation between typedef and struct declaration (even though the old
> approach of doing it all at once works).

Actually, I don't see any clear-cut policy on the matter (all HACKING
says is that "Typedefs are used to eliminate the redundant 'struct'
keyword", but does not say how aggressively they must be used).  In
fact, it looks like most of qemu.git prefers the more compact
representation, while your patch goes to the less-common one:

$ git grep 'typedef struct .* {' | wc
   1370    5549   71105
$ git grep 'typedef struct .*;' | wc
    624    2515   41449

However, one thing that your style has going for it, that was not
possible with the compact version, is to use:

 typedef struct intList intList;
 struct intList {
     union {
         int64_t value;
         uint64_t padding;
-    struct intList *next;
+    intList *next;

that is, because your typedef is separate, you have the option of being
able to drop the use of 'struct' from within the actual intList struct.
 Again, if we want that, it would be better to do that as a separate commit.

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]