Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!mordor!sri-spam!rutgers!dayton!umn-cs!herndon From: herndon@umn-cs.UUCP Newsgroups: comp.lang.c Subject: Re: Why pass structs? (not struct pointe Message-ID: <53900005@umn-cs.UUCP> Date: Sun, 1-Mar-87 19:49:00 EST Article-I.D.: umn-cs.53900005 Posted: Sun Mar 1 19:49:00 1987 Date-Received: Tue, 3-Mar-87 23:52:14 EST References: <3346@cisunx.UUCP> Lines: 24 Nf-ID: #R:cisunx:-334600:umn-cs:53900005:000:1327 Nf-From: umn-cs!herndon Mar 1 18:49:00 1987 Maybe my argument will be silly too, but the arguments that I have seen so far strike me as hilarious. As far as I can figure, no operation in original C ever did anything that incurred non-obvious costs in either space or time. By significant, I mean such as scanning an object of large size, allocating space for a pass-by-value array, etc. The user, if he needed to copy a structure or allocate a large array, was forced to do this himself, *explicitly*. Where C did allocate space for large objects, the declaration was apparent, e.g., "struct foo bletch[10000];". This is convenient for those who write performance sensitive code -- no innocent looking statement is going to chew up megabytes and megacycles of resources. In today's enlightened world, however, programmer convenience is more heavily stressed, and if the user wants it, the user gets it. My personal opinion is that this is the correct choice. I have, however, on many occasions, in a production environment, seen otherwise competent programmers wondering in disbelief at their programs when they get run-time errors from procedures that pass LARGE parameters by value on machines with memories only somewhat bigger than the parameters. It still amazes me how little some "professional programmers" understand "high-level language" compilers.