Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!fauern!opal!tmpmbx!utopia!sunrise!hotte From: hotte@sunrise.in-berlin.de (Horst Laumer) Newsgroups: comp.lang.misc Subject: Re: Oh no! It's pointers vs arrays again! Message-ID: Date: 17 Dec 90 07:22:25 GMT References: <2392:Nov2902:59:0590@kramden.acf.nyu.edu> <7339@lanl.gov> <184a59d8.ARN0ebd@pilhuhn.uucp> <14651@smoke.brl.mil> <11@garth.UUCP Organization: HL EDV-Beratung Lines: 46 userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) writes: >In article <11@garth.UUCP>, smryan@garth.UUCP (Steven Ryan) writes: >>>has essentially only one form of data structuring, the array, while in >>>C arrays are much less commonly used, other more appropriate data >>>structures taking their place. Thus, while vectorization is important >>>. . . >> >>I infer from this that chasing pointers throughout memory is considerred >>a better programming practice. Pointer chasing is not only good for trashing >>the cache but for thrashing virtual memory as well. ><<>> >>As far as machine efficiency is concerned, pointer chasing can require >>fewer probes, but it is sequential and accesses memory randomly and >>unpredicatably. Memory sweeping probes every item, but it is parallel >>(or vectorisable) and accesses memory predicatably and sequentially. > >The only "randomly and unpredictably" aspects of how "pointer >chasing" works is when someone tries to drive a C compiler >without at least a learner's permit. Pointer operations in >a "correct" program is completely predictable, in that the >results achieved are correct. If you are concerned with the >fact that the values of the actual addresses used in pointers >is difficult to determine from reading the code, you may have >missed the whole point of "abstraction". The address values >are a detail that, like hexadecimal arithmetic, you can >usually forget about. > Right, my dear! C ain't PASCAL, where "address of object X" may not be the same as "pointer to object X". (BTW, in another article, I saw the question "how to PEEK() and POKE() in C....". Horrible imagination!) Suggestion: try to understand the man-page of qsort(3) or something like that! --HL -- ============================================================================ Horst Laumer, Kantstrasse 107, D-1000 Berlin 12 ! Bang-Adress: Junk-Food INET: hotte@sunrise.in-berlin.de ! for Autorouters -- me -- UUCP: ..unido!fub!geminix!sunrise.in-berlin.de!hotte