Message from discussion Questions about pointer comparisons
From: Keith Thompson <ks...@mib.org>
Subject: Re: Questions about pointer comparisons
Date: Tue, 01 Dec 2009 17:03:45 -0800
Organization: None to speak of
References: <email@example.com> <7nkgshF3lna8iU1@mid.uni-berlin.de> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
Content-Type: text/plain; charset=us-ascii
X-Trace: news.eternal-september.org U2FsdGVkX1+2kdQnlBgqN1ee6IBDdvw58YXzU9MBzTpMZQw57ef+4peY+GrnJmkIjgaZUaR9RAQP5AVzz4W1YLd4PKODHC9TY2PaZokMsJFd6tx5qaDkfuqeppLTJlCb
NNTP-Posting-Date: Wed, 2 Dec 2009 01:06:01 +0000 (UTC)
User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/21.4 (gnu/linux)
Kaz Kylheku <kkylh...@gmail.com> writes:
> On 2009-12-01, Keith Thompson <ks...@mib.org> wrote:
>> If the language required "<" and ">" to work consistently for pointer
>> values (i.e., for any two valid pointers p1 and p2, exactly one of
>> (p1 < p2), (p1 == p2), and (p1 > p2) is true, along with the other
>> usual consistency requirements), then the "<" and ">" operators
>> *would* have to do all that work.
> Which means that code targetting 8086 machines would be larger and slower,
> having to normalize segment:offset values rather than blindly comparing
> them as 32 bit words.
> When C was standarized, this architecture was widespread, and used
> as a target for C programming. Standardizing pointer inequality would have
> codified code that didn't work on MS-DOS, at least in some memory models.
> This issue is now worth revisiting.
Agreed (except that I think you meant relational operators, not
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"