Path: 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: 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 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. . / \ 'U` \_.--._/ v