qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Why QEMUClock is defined in qemu-timer.c?


From: Dmitry Zamaruev
Subject: Re: [Qemu-devel] Why QEMUClock is defined in qemu-timer.c?
Date: Tue, 31 Jan 2012 12:00:30 +0200

This is used in many places.
Maybe to simulate 'private' variables and access methods like in C++.

If you define structure in .c file then every function that works with
this structure must reside in same file. And any other code to use
structure must use access-functions (api) to alter it and not directly
(compiler will issue error about incomplete type).
This way you could change structure or internal data handling without
affecting external code that relies on "stable api functions".

On Tue, Jan 31, 2012 at 8:35 AM, Richard Yang
<address@hidden> wrote:
> On Tue, Jan 31, 2012 at 01:12:24PM +0700, Mulyadi Santosa wrote:
>>Hi :)
>>
>>On Tue, Jan 31, 2012 at 12:55, Richard Yang <address@hidden> wrote:
>>>
>>> Hi, experts
>>>
>>> I am just coming to the qemu world.
>>>
>>> While reading the code, I am wondering why put a struct definition in the
>>> c file?
>>>
>>> Seems there is no error in compile, while I felt it is not a proper way
>>> to do it.
>>
>>
>>maybe someone just forgot to refactor it :) I suggest to send a patch
>>to do just that and let's see what everybody thinks about. I, myself
>>thinks that the more readable the code is, the better
>
> Ok, let me do it.
>>
>>--
>>regards,
>>
>>Mulyadi Santosa
>>Freelance Linux trainer and consultant
>>
>>blog: the-hydra.blogspot.com
>>training: mulyaditraining.blogspot.com
>
> --
> Richard Yang
> Help you, Help me
>
>



reply via email to

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