Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Relationship between C and C++ Message-ID: <19253@megaron.cs.arizona.edu> Date: 22 Mar 90 06:59:53 GMT Organization: U of Arizona CS Dept, Tucson Lines: 29 In article <33316@brunix.UUCP> drc@cs.brown.edu (David R. Chase) writes: >In article <5200048@m.cs.uiuc.edu> robison@m.cs.uiuc.edu writes: >>This is not the first attack on pointer arithmetic that I have seen. >>Why is pointer arithmetic denigrated so much? The C-style pointer >>arithmetic seems to me to implement a fairly simple abstraction, >>roughly equivalent to ``a tape and a read/write head.'' > >Well, one good reason is that in many cases where it pays to do >pointer arithmetic (loop invariant code, reduction in strength, >redundant expression elimination), the compiler can do (using >algorithms published more than 5 years ago) about as good a job as you >can, except that it won't occasionally make mistakes, and it will >remember to get it right again when the code is modified. It seems that most C pointer critics (like this one) are making the assumption that pointers are used only to avoid inefficiency in array indexing. Quite the contrary. I do a lot of C programming, and I choose beteen the array abstraction and the pointer abstraction by whichever fits the problem better. Pointers are just another form of abstraction, one that a lot of people find quite useful and intuitive. I have seen several comments that pointers are a "low-level" mechanism. This strikes me as a content-free statement. Just how is "low-level" being defined? -- David Gudeman Department of Computer Science The University of Arizona gudeman@cs.arizona.edu Tucson, AZ 85721 noao!arizona!gudeman