Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!crdgw1!underdog!shane From: shane@underdog.crd.ge.com (Randall H. Shane) Newsgroups: alt.religion.computers Subject: Re: Shoulds arrays start at zero or one? Message-ID: <4822@crdgw1.crd.ge.com> Date: 16 Jan 90 21:24:44 GMT References: <252@usblues.UUCP> <1990Jan16.173034.25686@murdoch.acc.Virginia.EDU> Sender: news@crdgw1.crd.ge.com Reply-To: shane@underdog.crd.ge.com (Randall H. Shane) Distribution: na Organization: GE Corporate R&D Center Lines: 39 In article <1990Jan16.173034.25686@murdoch.acc.Virginia.EDU> gl8f@astsun.astro.Virginia.EDU (Greg Lindahl) writes: ] In article <252@usblues.UUCP> tom@usblues.UUCP (Tom Markson) writes: ] >Pascal does the pointer manipulations for you. In pascal, if I wish to change ] >a "val" parameter to a reference variable all I must do is add var to it's ] >declaration. In C, I must recode every single occurance of that variable in ] >the func to a pointer. (from variable to *variable). In short, C places the ] >burden on the programmer. ] Of course, the performance implications of "var" are enormous and often ] not told to Pascal students. "I'm passing this 50k array into a procedure, ] and, oh, well I don't want to modify it, so I'd better not make it var." ] Then your stoopid Pascal compiler makes a local copy... Of course, the performance implications of 'stoopid' compilers are enormous, and often not told to USENET posters. Stupid compilers exist for most, if not all languages, and the mere existence of stupid compilers is hardly a reason to slam a computer language. Intelligent Pascal compilers, while enforcing the semantics of var and non-var parameters in the program text, for efficiency's sake pass large structures such as arrays by reference in both cases. This efficient implementation is not a contradiction of the programmer's intent, let us note.... C has some advantages over Pascal, but the syntax and semantics of C's parameter passing sure as hell isn't one of them. ] I should think most C programmers don't find *var to be much of a burden ] at all. IMHO, it's one of the small irritations about C that add up over time... There are many advantages to a language that allows you to fiddle around at the lowest levels, but having to worry about the tiniest, most trivial details at every level is irritating. The conjunction of pointer manipulation primitives and var parameter passig is one of the irritating details that should be hidden most of the time. -- Randall Shane [shane@disney.crd.ge.com] "My daughter is being taught that there is no person greater than Lenin. I brought her here so that she could see a man greater than Lenin." -- Russian woman at a memorial service for Andrei Sakharov