Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!gatech!mcnc!decvax!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: The D Programming Language Message-ID: <25284@cca.CCA.COM> Date: 5 Mar 88 06:30:53 GMT Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 34 Here is another feature for D whose absence in C has been irksome to me -- I would like to be able to return several items from a function. The problem is that arguments to C are passed by copying the value -- this is loverly since it means that my function can't munge the stuff passed to it. But how do I get stuff back. I can pass one thing back via the return statement. To pass more than one thing I have to play games. Things which are returned need a mechanism equivalent to pass by address. An ancient and venerable way to handle this is to have 'in', 'out', and 'update' qualifiers for arguments. I have seen this used in several languages, and my observation is that it doesn't work; people end up bypassing the mechanism. The following example is illustrative syntax only: [int *,int] foobar(); .... [ptr,flag] = foobar(arg) int arg; { int *a, *b; .... return [a,1]; .... return [b,0]; } -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.