Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!linus!decvax!minow From: minow@decvax.UUCP (Martin Minow) Newsgroups: net.lang.c Subject: Array by value Message-ID: <171@decvax.UUCP> Date: Thu, 18-Aug-83 18:39:51 EDT Article-I.D.: decvax.171 Posted: Thu Aug 18 18:39:51 1983 Date-Received: Fri, 19-Aug-83 01:40:25 EDT Organization: DEC UNIX Engineering Group, Merrimack, NH Lines: 38 Arnold Robbins suggests adding the ` operator to C to mean "array by value" as in: int a[10]; b[10]; ... `a = `b; /* I may have misrembmered the syntax */ There are several problems with this. First, all C expressions return a value, so I should be able to write statements such as if ((`a = `b) != 0) which is going to cause great pains for compiler writers. The other problem is that this suggestion rejects one of the primary C design philosophies -- that of making "easy things easy and hard things hard". Most compiler writers will generate something like "`a = `b": _bcopy(&a[0], &b[0], sizeof a); A suitably written _bcopy will run at memory speeds for all non-trivial cases. I am willing to bet that all the reasonable "array by value" operations could be implemented just as efficiently by a macro preprocessor. I should also note that Andrew's other suggested operator, '$' is valid in identifiers in Vax-11C, Decus C, and probably a few other PDP-11 compilers running on Dec machines. ('$' is necessary to access system-wide variables on Dec operating systems.) Martin Minow decvax!minow