Path: utzoo!mnetor!uunet!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: Returning several values (was Re: The D programming language) Message-ID: <25417@cca.CCA.COM> Date: 9 Mar 88 22:25:38 GMT References: <12206@brl-adm.ARPA> Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 21 In article <12206@brl-adm.ARPA> GAY%CLSEPF51.BITNET@CUNYVM.CUNY.EDU writes: ... basically saying to use a struct to hold the return values. Yeah, sometimes this is exactly what you want to do. There are a couple of catches. The first is that the returned values may not naturally go into a structure in the calling program. The second is that you now have to communicate the declaration of the structure between the two routines; okay, sortof, if they are in the same file, not so okay if they are in different files. Since all good little programmers avoid replicating declarations like the plague, you put the temporary structure definition in an include file. In a large program you end up with a lot of these yucky little include files, or clump them in a big include file with all that says about data coupling. As a practical matter, in C as it stands, my experience says that it's better to bite the bullet and pass pointers, doing call by reference by hand -- the code maintenance problems are less. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.