Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: Addresses of parameters Message-ID: <29781@think.UUCP> Date: 27 Oct 88 19:16:32 GMT References: <35620@XAIT.Xerox.COM> <10124@haddock.ima.isc.com> <35664@XAIT.Xerox.COM> Sender: news@think.UUCP Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 19 In article <35664@XAIT.Xerox.COM> g-rh@XAIT.Xerox.COM (Richard Harter) writes: >taking the address of a parameter is not a useful kind of thing to do. Why not? You are assuming that taking the address of a variable is only used when you plan to use it as an output parameter for a function. There are, however, functions that take pointers to input data. A good example is write(), which takes a pointer to the data to be written. Suppose you write a function that takes a structure as a parameter, and it wants to write that structure to a file, using write(). It will either take the address of the structure parameter, or it will have to make an automatic copy of the structure and take the address of that. I think taking the address of the parameter is preferable to making ANOTHER copy of the structure (the first copy has to be made during the calling sequence of the function). Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar