From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
nico@cam.org, git@vger.kernel.org,
Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH] block-sha1/sha1.c: silence compiler complaints by casting void* to uintptr_t
Date: Fri, 14 Aug 2009 18:46:46 -0700 [thread overview]
Message-ID: <7v8whl7ss9.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <5HEgWEs64y4Ty7FnekstRP8Q71pNi_FTweLbMhYWc6zoZBA4jkJqpQ@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Fri\, 14 Aug 2009 19\:44\:38 -0500")
Brandon Casey <casey@nrlssc.navy.mil> writes:
> Linus Torvalds wrote:
>> I suspect it might as well be cast to "const char *", and then
>> hopefully you only need one cast.
>>
>> So maybe it could be written as
>>
>> data = (const char *) data + len;
>>
>> instead, and avoid the second cast (because the assignment should be ok,
>> since it's assigning back to a "const void *").
>
> Yep, that's enough. It produces an identical binary on all platforms
> except Solaris x86 using SUNWspro compiler.
Casting to "const char *" to tell compilers that we are interested in byte
address differences/increments makes sense to me, but I do not know how to
interpret your last comment.
Do you mean that SUNWspro compiler misbehave with the "cast to char *" and
do you meed your "casting to uintptr_t to explicitly compute byte
addresses as int" to make it behave?
next prev parent reply other threads:[~2009-08-15 1:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 4:29 [PATCH] block-sha1: more good unaligned memory access candidates Nicolas Pitre
2009-08-13 16:45 ` Linus Torvalds
2009-08-13 17:23 ` Nicolas Pitre
2009-08-13 19:33 ` Junio C Hamano
2009-08-13 19:54 ` Linus Torvalds
2009-08-13 20:13 ` Nicolas Pitre
2009-08-14 22:52 ` [PATCH] block-sha1/sha1.c: silence compiler complaints by casting void* to uintptr_t Brandon Casey
2009-08-15 0:08 ` Johannes Schindelin
2009-08-15 0:19 ` Linus Torvalds
2009-08-15 0:44 ` Brandon Casey
2009-08-15 1:46 ` Junio C Hamano [this message]
2009-08-15 2:34 ` Brandon Casey
2009-08-15 3:16 ` Junio C Hamano
2009-08-15 18:43 ` Linus Torvalds
2009-08-15 0:52 ` Brandon Casey
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=7v8whl7ss9.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=nico@cam.org \
--cc=torvalds@linux-foundation.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