Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!oberon!sm.unisys.com!ism780c!news
From: news@ism780c.isc.com (News system)
Newsgroups: comp.lang.c
Subject: Re: Out of range pointers
Message-ID: <16586@ism780c.isc.com>
Date: 21 Sep 88 21:19:57 GMT
References: <867@osupyr.mast.ohio-state.edu> <3200@geac.UUCP> <1430@ficc.uu.net> <1988Sep15.145026.20325@ateng.uucp> <16041@ism780c.isc.com> <8515@smoke.ARPA> <33432@cca.CCA.COM> <1988Sep19.213023.13181@utzoo.uucp> <33547@XAIT.XEROX.COM>
Reply-To: marv@ism780.UUCP (Marvin Rubenstein)
Organization: Interactive Systems Corp., Santa Monica CA
Lines: 26

In article <33547@XAIT.XEROX.COM> g-rh@XAIT.Xerox.COM (Richard Harter) writes:
>
>As a side note, one argument for making x[-1] legal is that it permits
>you to use sentinels in both directions.  I don't see that this is a
>problem, regardless of architecture.  All that is required is that nothing
>be allocated on a segment boundary.  However, as the man says, they way
>it is is the way it is.  There never was a machine, a language, or an
>operating system without arcane restrictions.  [Except lisp :-)]
>-- 

Consider:

   some_big_type x[2];

If sizeof(some_big_type) is half the size of a segement, computing &x[-1] is
no harder (or easier) than computing &x[2].  The standard mandates that
&x[2] be computable but it does not mandate that &x[-1] be computable.  I
suspect that a C implementation that allows arrays as large as large as a
segment is able to compute both addresses.

Note, mandating that &x[-1] be computable does not mean that x[-1] is
referencable.  So evenif &x[-1] were computable we still could not have a
sentinel at the low end of the array.  A sentinal at the low end is easy.
just start the data with x[1].

   Marv Rubinstein