Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!linus!decvax!harpo!eagle!allegra!alan From: alan@allegra.UUCP Newsgroups: net.lang.c Subject: Re: mixing pointers and arrays Message-ID: <1742@allegra.UUCP> Date: Mon, 15-Aug-83 12:15:15 EDT Article-I.D.: allegra.1742 Posted: Mon Aug 15 12:15:15 1983 Date-Received: Mon, 15-Aug-83 16:51:02 EDT References: <1737@allegra.UUCP>, <1795@umcp-cs.UUCP>, <191@cbosgd.UUCP> Organization: Bell Labs, Murray Hill Lines: 32 I think my ideas about arrays being passed by value were misunderstood, at least by one person. A follow-up article made these points: (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. Yes, this fix to the language would break a lot of programs, but if the change were made, and the broken programs fixed, they would not be any less efficient than they were before, and routines like strcpy would still work just fine. len = strlen(s); would just be replaced with len = strlen(&s); I'm certainly not saying arrays should always be passed by value. People pass pointers to structures all the time, even though they could pass the structure by value, if they chose. I would just like the same choice with arrays. It would make the language simpler, clearer, and more consistent. Alan Driscoll Bell Labs, Murray Hill