Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!ncsuvx!gatech!ukma!nrl-cmf!ames!amelia!lemming.nas.nasa.gov!fouts From: fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts) Newsgroups: comp.lang.fortran Subject: Re: Arrays and pointers Message-ID: <1032@amelia.nas.nasa.gov> Date: 21 Sep 88 23:17:54 GMT References: <1030@amelia.nas.nasa.gov> <3968@lanl.gov> Sender: news@amelia.nas.nasa.gov Reply-To: fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts) Organization: NASA Ames Research Center Lines: 35 In article <3968@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >From article <1030@amelia.nas.nasa.gov>, by fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts): >> [...] Now add to it the >> notational convenience of using pointers when they make the code >> clearer to read then array references. [...] > >That is - _NEARLY_NEVER_!! A pointer is a way of placing the structural >template defined by a data type over an arbitrary memory location. > ^ >PERIOD!! That's all a pointer is for. NO. NO. NO. (Gee, I can capshout too ;-) A pointer is also a mechanism by which I introduce an arbitrary data structure into my language, allowing me to easily express data structures that the original language designer didn't think to provide. As Wirth pointed out in the Pascal design, structure+new/dispose+pointer-to-structure allows construction of arbitrary data structures. Unless, of course, you believe that you can correctly identify and supply all of the data structures that I'm going to need, and you want to burden all programers with being aware of all these data structures. Consider the case of FIFOs. I can fairly easily implement a fixed length FIFO using an array, but I grew up on data structures texts where it was always done with a linked list and to me such an approach produces more readable code. (Your milage may vary, but such is the notation I'm use to.) Marty +-+-+-+ I don't know who I am, why should you? +-+-+-+ | fouts@lemming.nas.nasa.gov | | ...!ames!orville!fouts | | Never attribute to malice what can be | +-+-+-+ explained by incompetence. +-+-+-+