From: Fabrice Bellard <fabrice@bellard.org>
To: thayne@c2.net
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target_posix_types.h
Date: Wed, 14 Nov 2007 20:14:48 +0100 [thread overview]
Message-ID: <473B4928.9030607@bellard.org> (raw)
In-Reply-To: <1195065836.918.61.camel@phantasm.home.enterpriseandprosperity.com>
Thayne Harbaugh wrote:
> On Wed, 2007-11-14 at 19:32 +0100, Fabrice Bellard wrote:
>> Thayne Harbaugh wrote:
>>> This patch, 44_target_posix_types.patch provides target specific posix
>>> types. These types improve target structure creation, code similarity
>>> to kernel code and improve type casting for assignment between target
>>> and host.
>> Why is it needed ?
>
>
> It's not *necessary*, but it makes code more readable and it simplifies
> having to always check for what a typedef on a target might map to. It
> makes target structures more comparable to their structures in the
> kernel.
>
> A simple example:
>
> struct target_timeval {
> abi_long tv_sec;
> abi_long tv_usec;
> };
>
> vs.
>
> struct target_timeval {
> target_time_t tv_sec;
> target_suseconds_t tv_usec;
> };
>
>
> It also makes type conversion between target and host more obvious.
>
> It also means that more code can be shared rather than #ifdef'ed when
> targets differ on their base definitions.
>
> It's just another level of abstraction, we can always stick with
> abi_long, abi_ulong, etc.. I've just noticed that size and sign
> handling when converting between target and host are a common source of
> errors and this simplifies things. We use it in all our patches and it
> has helped simplify and fix errors.
I don't like adding levels of abstraction unless I am really forced. I
think these types makes the code more difficult to understand without
real added value. In particular, it does not help for sign conversions.
Fabrice.
next prev parent reply other threads:[~2007-11-14 19:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-14 15:59 [Qemu-devel] [PATCH] target_posix_types.h Thayne Harbaugh
2007-11-14 16:03 ` [Qemu-devel] Re: [PATCH] tget/tput deprecation Thayne Harbaugh
2007-11-14 16:08 ` Thayne Harbaugh
2007-11-14 18:21 ` Thayne Harbaugh
2007-11-14 19:02 ` Thayne Harbaugh
2007-11-16 4:16 ` Thayne Harbaugh
2007-11-14 16:25 ` [Qemu-devel] [PATCH] target_posix_types.h Jocelyn Mayer
2007-11-14 17:36 ` Thiemo Seufer
2007-11-14 17:54 ` Jocelyn Mayer
2007-11-14 18:20 ` Thayne Harbaugh
2007-11-14 18:32 ` Fabrice Bellard
2007-11-14 18:43 ` Thayne Harbaugh
2007-11-14 19:14 ` Fabrice Bellard [this message]
2007-11-14 19:53 ` Thayne Harbaugh
2007-11-14 20:39 ` Paul Brook
2007-11-14 21:06 ` Warner Losh
2007-11-14 21:25 ` Thayne Harbaugh
2007-11-14 21:19 ` Thayne Harbaugh
2007-11-14 21:37 ` Paul Brook
2007-11-14 19:56 ` Thayne Harbaugh
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=473B4928.9030607@bellard.org \
--to=fabrice@bellard.org \
--cc=qemu-devel@nongnu.org \
--cc=thayne@c2.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.