From: Junio C Hamano <gitster@pobox.com>
To: David Kastrup <dak@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: C standard compliance?
Date: Wed, 29 Jan 2014 12:42:19 -0800 [thread overview]
Message-ID: <xmqqwqhiikpg.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <87iot25y0r.fsf@fencepost.gnu.org> (David Kastrup's message of "Wed, 29 Jan 2014 21:33:08 +0100")
David Kastrup <dak@gnu.org> writes:
> Hi, I am wondering if I may compare pointers with < that have been
> created using different calls of malloc.
>
> The C standard does not allow this (inequalities are only allowed for
> pointers into the same structure) to allow for some cheapskate sort of
> comparison in segmented architectures.
Hmm... if you were to implement a set of pointers in such a way that
you can cheaply tell if an unknown pointer belongs to that set, you
would use a hashtable, keyed with something that is derived from the
value of the pointer casted to uintptr_t, I would think. Is such a
use of ((uintptr_t)ptr) unallowed? If it is allowed, comparing two
unrelated pointers after casting them to uintptr_t would equally be
valid, I would have to think.
next prev parent reply other threads:[~2014-01-29 20:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-29 20:33 C standard compliance? David Kastrup
2014-01-29 20:42 ` Junio C Hamano [this message]
2014-01-29 20:52 ` David Kastrup
2014-01-29 23:00 ` Philip Oakley
2014-01-29 23:33 ` brian m. carlson
2014-01-30 0:02 ` David Kastrup
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=xmqqwqhiikpg.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=dak@gnu.org \
--cc=git@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.