🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1156

Re: Pointers as 3-tuples (Re: JLG's flogging of horses (was Re: Relationship between C and C++))

#1156
From: Peter da Silva
Date: Tue, 10 Apr 1990 12:25
34 lines
1869 bytes
In article <14316@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes:
> Pointers are more general than arrays in that they are free from bounds
> checking and allow arbitrary aliasing.

The first statement here is false, as I have demonstrated. By making a
pointer a 3-tuple (low, current, high) it is subject to the same bounds
checking. The second statement is irrelevant, because arrays can also be
arbitrarily aliased. Fortran sidesteps this problem by declaring that this
aliasing is illegal, but really doesn't provide a mechanism for ensuring
that no illegal aliasing is going on. Other languages make no such
guarantees.

> Arrays are more general than
> pointers in that they can be multiply dimensioned.

The C semantics of multiply dimensioned arrays as arrays of arrays
demonstrates the opposite.

> Pointers are only isomorphic to _one_dimensional_arrays_, and only if
> their aliasing and freedom from bounds are both curtailed.

The first statement is false, because C semantics treats pointers as
multiply dimensioned arrays (given a proper declaration), and the second
statement is only true for programs that are broken in any case... just
like Fortran programs where you do something like:

	INTEGER A(10)

	CALL PROC(A,A)
-- 
 _--_|\  `-_-' Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \  'U`
\_.--._/
      v
Technical Details
Message-ID: <S4U2APBggpc2@ficc.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!texbell!ficc!peter
References: <1BT2FU7ggpc2@ficc.uu.net> <14316@lambda.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!texbell!ficc!peter
From: peter@ficc.uu.net (Peter da Silva)
Newsgroups: comp.lang.misc
Subject: Re: Pointers as 3-tuples (Re: JLG's flogging of horses (was Re: Relationship between C and C++))
Message-ID: <S4U2APBggpc2@ficc.uu.net>
Date: 10 Apr 90 12:25:40 GMT
References: <1BT2FU7ggpc2@ficc.uu.net> <14316@lambda.UUCP>
Reply-To: peter@ficc.uu.net (Peter da Silva)
Organization: Xenix Support, FICC
Lines: 29