Why QEMUClock is defined in qemu-timer.c?
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.
Signature · 2 lines
Richard Yang Help you, Help me
Hi :)
Quoted 10 lines · Richard Yang
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
Signature · 7 lines
regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Quoted 11 lines · Mulyadi Santosa
Hi :)
Quoted 8 lines · Richard Yang
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?
Quoted 7 lines
Quoted 2 lines
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.
Quoted 9 lines
Signature · 8 lines
-- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Signature · 2 lines
Richard Yang Help you, Help me
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".
Quoted 36 lines · Richard Yang
Quoted 11 lines · Mulyadi Santosa
Hi :)
Quoted 8 lines · Richard Yang
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?
Quoted 7 lines
Quoted 2 lines
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.
Quoted 9 lines
--
regards,Mulyadi Santosa
Freelance Linux trainer and consultantblog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com--
Richard Yang
Help you, Help me
Quoted 9 lines · Dmitry Zamaruev
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".
Thanks for your explanation.
I learned a lot.
Signature · 2 lines
Richard Yang Help you, Help me