From: Matthew Wilcox <matthew@wil.cx>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] question on double cast
Date: Tue, 22 May 2007 13:44:37 +0000 [thread overview]
Message-ID: <20070522134437.GF18519@parisc-linux.org> (raw)
In-Reply-To: <87y7jh4669.fsf@wanadoo.fr>
On Tue, May 22, 2007 at 08:52:14AM -0400, John Anthony Kazos Jr. wrote:
> > But isn't it equivalent to directly do
> >
> > wr->ep_handle = (u32) cm_id->provider_data;
>
> Depends on the endian-ness if you're on a 64-bit architecture. You'll get
> the high-order 32 or the low-order 32 depending on which are in the first
> 4 bytes of the 64-bit quantity. The only way that would be safe is if the
> quantity is never wider than 32 bits.
That would be true if there were a pointer dereference involved, but
it's just a cast. You'd get the low 32-bits either way, but you get a
warning on 64-bit.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
prev parent reply other threads:[~2007-05-22 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-22 8:24 [KJ] question on double cast Yoann Padioleau
2007-05-22 11:44 ` John Anthony Kazos Jr.
2007-05-22 12:15 ` Yoann Padioleau
2007-05-22 12:52 ` John Anthony Kazos Jr.
2007-05-22 12:54 ` Matthew Wilcox
2007-05-22 13:44 ` Matthew Wilcox [this message]
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=20070522134437.GF18519@parisc-linux.org \
--to=matthew@wil.cx \
--cc=kernel-janitors@vger.kernel.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 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.