Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ccvaxa Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang.c Subject: Re: Address of array Message-ID: <2600043@ccvaxa> Date: Mon, 31-Mar-86 12:13:00 EST Article-I.D.: ccvaxa.2600043 Posted: Mon Mar 31 12:13:00 1986 Date-Received: Sat, 5-Apr-86 00:46:50 EST References: <750@abic.UUCP> Lines: 16 Nf-ID: #R:abic.UUCP:750:ccvaxa:2600043:000:841 Nf-From: ccvaxa.UUCP!aglew Mar 31 11:13:00 1986 struct and array pass-by-value and return - a moderate view: Structures should always be passed by reference. Usually you only need to look at fields, and if you need scratch space then you should declare local variables. (Modify this for structs that fit in small packages, like struct { short x,y; }). However, being able to return structs without having to worry about allocating space is a great convenience. Actually, what is needed is return of pointers, with a convenient way of automatically allocating space for the struct that you're going to point to. This way you get convenience and the efficiency of not having all those extra copies to and from the stack. Doesn't everybody use a `statalloc' package for this type of thing? Structure and array assignment, and comparison for equality, without buffer copies is a good thing.