[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 1/2] Emulated CCID card: QOMify
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-trivial] [PATCH 1/2] Emulated CCID card: QOMify |
Date: |
Tue, 2 Feb 2016 11:30:54 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
02.02.2016 11:25, Cao jin wrote:
> On 02/02/2016 04:15 PM, Michael Tokarev wrote:
>> Why did you move the type definition from .c to .h file?
>> It is only referenced in .c, no?
[]
> Yes, that type definition is referred only in .c for now, but we are not sure
> about it in the future, for better flexibility, I think put it into .h is
> better. http://wiki.qemu.org/QOMConventions also says:
>
> DO use TYPE_FOO constants, defined in a header if used in other parts of code
The last words in this sentense makes sense, I think:
"if used in other parts of the code".
So I read it as 2-part suggestion:
1) use TYPE_foo constants instead of "literals", and
2) define them in a header file if used elsewhere too.
The "future flexibility" is, in my opinion, questionable.
If we'll use them in the future, we can always move the
#define to the header file. For now, there's no need
to clutter the heade more, but there's a good reason
to use the #define in the "home" .c file where this
device is implemented, in all places where the device
name is referenced.
At least that's how I read this (somewhat ambiguous)
suggestion in the wiki.
Thanks,
/mjt