qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] new to qemu with a simple question


From: Wang Dong
Subject: Re: [Qemu-devel] new to qemu with a simple question
Date: Fri, 26 May 2017 12:54:38 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0



On 05/24/2017 09:30 PM, Eric Blake wrote:
On 05/23/2017 09:56 PM, Wang Dong wrote:
Hi guys,

I am new to qemu. But I need do some job in it right now.

When I try read qmp code. I found a interesting part against it.

Some C source code is generate from json file.

I wonder why this? What is the benefits of this?
Boring and repetitive code that is easy to typo is best written by
computer, which excels at boring and repetitive tasks.  Writing our
description in a more concise higher language and generating C code from
that lets us focus on the actual design, rather than the mundane
correctness of the code implementing the design.

It's the same reason that people use bison/yacc rather than hand-written
parsers for complex grammars - you isolate the correctness of the code
to the correctness of the generator, and free yourself to now only have
to worry about the bigger picture of the input you feed to the
generator.  And on another level, it's why we write programs in C
instead of assembly.  Abstraction is good.

Thanks for your reply. I really appreciate it.

--
Best regards. Wang Dong




reply via email to

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