Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site cbosgd.UUCP Path: utzoo!linus!decvax!harpo!gummo!whuxlb!pyuxll!eisx!npoiv!npois!hogpc!houxm!ihnp4!cbosgd!mark From: mark@cbosgd.UUCP Newsgroups: net.lang.c Subject: Re: mixing pointers and arrays Message-ID: <191@cbosgd.UUCP> Date: Sun, 14-Aug-83 16:51:21 EDT Article-I.D.: cbosgd.191 Posted: Sun Aug 14 16:51:21 1983 Date-Received: Mon, 15-Aug-83 04:22:35 EDT References: <1737@allegra.UUCP>, <1795@umcp-cs.UUCP> Organization: Bell Labs, Columbus Lines: 29 Having arrays passed by value instead of by reference would indeed clean up the language. However, let's take a look at some of the consequences of this move: (1) Almost all existing programs would have to be rewritten, since the change would not be upward compatible. (2) If all arrays are passed by value, then character strings must be passed by value as well (after all, they are arrays of characters). This means (a) programs will be slower, so that the copy can be made, (b) programs will be bigger, for a place to copy to, (c) subroutines that modify a character string in place (like strcpy) will stop working. (3) The above comments also apply to big arrays of things. In a language such as Pascal, arrays being passed by value are one of the worst causes of very slow programs (especially when the author just didn't realize the array was going to be copied). (4) The whole paradigm that arrays and pointers are interchangable would have to be redone, no doubt losing upward compatibility. Remember that C is not a general purpose high level applications programming language, it's a systems implementation language. This means it's closer to the machine, and you are supposed to be aware of what's going on in the underlying machine. The fact that so many people are using C for applications shows not that C is well suited for applications, but that it's usable for applications and nothing else is supported as well on UNIX. Mark Horton