Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!AI.MIT.EDU!bson From: bson@AI.MIT.EDU (Jan Brittenson) Newsgroups: comp.society.futures Subject: Re: C's sins of commission (was: (pssst...fortran?)) Message-ID: <9009201017.AA06087@rice-chex> Date: 20 Sep 90 10:19:13 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 52 X-Unparsable-Date: Thu, 20 Sep T 06:17:39 EDT So how would you propose to accomplish the following, for example, without pointers or pointer arithmetic? 1. Pointer range check (see if a buffer crosses page boundaries, for instance). 2. Calculate physical addresses for DMA controllers. 3. Sort a linked list on addresses of some data pointed to from within the node. Or to keep it sorted as new (addresses of) data is added. 4. Implement malloc()/free(). 5. Read and write addresses from/to pipes. I wonder whether any compiler can be designed to successfully determine when to duplicate data and when to use a reference. As a rule, it's bad practise to duplicate data other than in the rare occasions when an explicit duplicate is needed. Usually any processing of the data constitutes duplication in itself, with the exact type/size of the resultant duplicate dependending on the interpretation of the original. I'm curious as to why so many programmers engage themselves in hot debates over how to best implement strings. String processing is proportionally insignificant - the first thing done after a read is usually a tokenization, either through hand-written code or the output of a lexical front-end generator. The string is nothing but a character buffer, irrelevant to the data or command itself - it's only the written/read representation of it, and can be discarded once tokenized. Strings held on to rarely need any further processing, they mostly get passed around by reference, or located through hash tables. Just like some algorithms cannot be reasonably coded without gotos - the alternative would likely be even worse - some operations on data or certain functionality cannot reasonably be performed without pointers. Certainly, all data types can be expressed without pointers - but so can they also in everyday English. Declarations and talk are to be distinguished from working programs. (No macho intent.) Finally, not all people agree with the view that "pointers are the data type equivalent of gotos." I for one think it's been a little stretched lately. A program like a device driver could probably be coded perfectly well without a single goto, but not without pointer arithmetic. Just my two cents worth. -- Jan Brittenson bson@ai.mit.edu