From: Eric Blake <eblake@redhat.com>
To: Wang Dong <dongdwdw@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] new to qemu with a simple question
Date: Wed, 24 May 2017 08:30:58 -0500 [thread overview]
Message-ID: <f5c021e4-86ce-7476-44dc-d386f2349ed0@redhat.com> (raw)
In-Reply-To: <f0b11c2d-9f61-c4c2-4b55-58644b760e31@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
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 a
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.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-05-24 13:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 2:56 [Qemu-devel] new to qemu with a simple question Wang Dong
2017-05-24 3:11 ` Fam Zheng
2017-05-24 8:37 ` Wang Dong
2017-05-24 13:30 ` Eric Blake [this message]
2017-05-26 4:54 ` Wang Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5c021e4-86ce-7476-44dc-d386f2349ed0@redhat.com \
--to=eblake@redhat.com \
--cc=dongdwdw@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).