Path: utzoo!attcan!uunet!seismo!esosun!ucsdhub!ucsd!ames!lamaster From: lamaster@ames.arc.nasa.gov (Hugh LaMaster) Newsgroups: comp.lang.fortran Subject: Re: Arrays and pointers Message-ID: <15269@ames.arc.nasa.gov> Date: 21 Sep 88 16:25:59 GMT References: <447@quintus.UUCP> <3826@lanl.gov> <1023@amelia.nas.nasa.gov> Reply-To: lamaster@ames.arc.nasa.gov.UUCP (Hugh LaMaster) Organization: NASA Ames Research Center, Moffett Field, Calif. Lines: 43 In article <1023@amelia.nas.nasa.gov> fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts) writes: > >Contrary to some of the arguments in this list, from the point of view >of a language designer, pointers/arrays serve very much the same >purpose. contiguous arrays are a compact special purpose mechanism >for annotating a mapping from names to addresses. Pointers also You lost me here. Arrays are a particular type of data structure. They are no different from any other type of data structure. So, if I generalize your argument, you could say "any data structure is a compact mechanism for annotating a mapping from names to addresses." Taken to an extreme, I don't need data structures at all, just pointers and memory cells. Which is true, but... ALMOST everyone thinks data structures are much clearer and less error prone than pointers and raw memory, and Portability always suffers when you drag in raw memory. Contrary to popular belief, not all machines are byte addressable, and not all byte addressable machines allow arbitrary alignment. In fact, not all machines have a single contiguous address space. For all of these reasons, old Fortran programmers prefer to use pointers ONLY for passing the address of a data structure around, and not for other things. >Some programmers would prefer not to have access to the expressive >power, as a way of avoiding making bugs. Others, myself included, are >willing to take the chance. I have not seen anyone in this group suggest abolishing pointers. In fact, it turns out that many Fortrans have pointers, as some people were boasting. The argument is whether pointers should be used for anything fancier than as a pointer to a data structure. I suggest that, from the point of view of project management, other uses of pointers should be treated like assembly language code: OK, if you have to, but, confine it to a small number of replaceable modules. -- Hugh LaMaster, m/s 233-9, UUCP ames!lamaster NASA Ames Research Center ARPA lamaster@ames.arc.nasa.gov Moffett Field, CA 94035 Phone: (415)694-6117