From: Jeff Garzik <jgarzik@pobox.com>
To: Eyal Lebedinsky <eyal@eyal.emu.id.au>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
linux-kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Linux 2.4.26-rc2
Date: Thu, 15 Apr 2004 20:58:04 -0400 [thread overview]
Message-ID: <407F2F9C.4030702@pobox.com> (raw)
In-Reply-To: <407F1769.9090700@eyal.emu.id.au>
Eyal Lebedinsky wrote:
> Marcelo Tosatti wrote:
>
>> The void pointer case in here its being done math on without any
>> problem. What is the
>> problem with void pointer math
>
>
> There is a problem regarding the C standard. The semantics of 'void *'
> are well defined
> and only allow for limited use. Basically, you can cast any pointer to
> and from 'void *',
> but nothing else.
>
> Pointer math says that 'p+n' means "add to 'p' the value 'n*s' where 's'
> is the size
> on the element that 'p' points to". A 'void *' does not have a defined
> element size
> until it is cast. So, ANSI specifically does not allow any arithmetics
> on 'void *'.
>
> Some compilers are forgiving and will invent an element size of '1' and
> allow the
> math. We should not rely on such improper usage.
Void pointer arithmatic is an explicit gcc extension, and used
extensively throughout the kernel.
Jeff
prev parent reply other threads:[~2004-04-16 0:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-06 0:42 Linux 2.4.26-rc2 Marcelo Tosatti
2004-04-06 1:57 ` Paul Mackerras
2004-04-08 19:11 ` Marcelo Tosatti
2004-04-11 6:20 ` Eyal Lebedinsky
[not found] ` <20040414121231.GA1406@logos.cnet>
2004-04-15 23:14 ` Eyal Lebedinsky
2004-04-16 0:58 ` Jeff Garzik [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=407F2F9C.4030702@pobox.com \
--to=jgarzik@pobox.com \
--cc=eyal@eyal.emu.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.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 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.