virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: xen-devel@lists.xensource.com,
	Jeremy Fitzhardinge <jeremy@xensource.com>,
	matt mooney <mfm@muteddisk.com>,
	x86@kernel.org, kernel-janitors@vger.kernel.org,
	Chris Wright <chrisw@sous-sol.org>,
	virtualization@lists.osdl.org, Ingo Molnar <mingo@redhat.com>,
	Tejun Heo <tj@kernel.org>, Thomas Gleixner <tglx@linutronix.de>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH 1/4] x86: remove cast from void*
Date: Tue, 14 Sep 2010 11:46:47 -0700	[thread overview]
Message-ID: <4C8FC317.8080408@goop.org> (raw)
In-Reply-To: <4C8FBD01.40900@zytor.com>

 On 09/14/2010 11:20 AM, H. Peter Anvin wrote:
> On 09/14/2010 10:49 AM, Jeremy Fitzhardinge wrote:
>>  On 09/13/2010 10:18 PM, matt mooney wrote:
>>> Unnecessary cast from void* in assignment.
>> Not very keen on this.  The cast may not be strictly required, but it
>> does document what's going on there.
>>
> But unnecessary casts are problematic in that if the type changes, they
> can hide a real bug in the future.

If page->private changes in a way which invalidates this kind of usage,
I would hope it would also change name to something more descriptive of
its new role.  If it changes type but is broadly compatible with this
usage (say, void * -> unsigned long), then the cast won't matter, or
will become a requirement.

I'm more concerned about "user_ptr" changing type, in which case the
cast will highlight the problem.

In general, the casts from these kinds of generic/polymorphic fields let
you easily eyeball how they're being used, without having to work out
what the type of the other side is.

    J

  reply	other threads:[~2010-09-14 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14  5:18 [PATCH 1/4] x86: remove cast from void* matt mooney
2010-09-14 17:49 ` Jeremy Fitzhardinge
2010-09-14 18:20   ` H. Peter Anvin
2010-09-14 18:46     ` Jeremy Fitzhardinge [this message]
2010-09-21 18:39 ` Jeremy Fitzhardinge
2010-09-21 19:15   ` matt mooney

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=4C8FC317.8080408@goop.org \
    --to=jeremy@goop.org \
    --cc=chrisw@sous-sol.org \
    --cc=hpa@zytor.com \
    --cc=ian.campbell@citrix.com \
    --cc=jeremy@xensource.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=mfm@muteddisk.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=virtualization@lists.osdl.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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).