Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!jarthur!elroy.jpl.nasa.gov!ucla-cs!rutgers!cbmvax!snark!eric From: eric@snark.uu.net (Eric S. Raymond) Newsgroups: comp.lang.c Subject: Re: Structures Message-ID: <1Vgw5j#17VOVh=eric@snark.uu.net> Date: 6 Mar 90 15:06:17 GMT References: <14302@reed.UUCP> <4390@daffy.cs.wisc.edu> <1990Mar5.183244.1013@utzoo.uucp> Lines: 17 In <1990Mar5.183244.1013@utzoo.uucp> Henry Spencer wrote: > The main motive for [structure-passing] is when you're essentially > building your own data types (complex numbers in sci/eng number-crunching, > two-dimensional coordinates in graphics, etc.) and want to treat them as > if they were ordinary values. Passing pointers gets troublesome very > quickly in such situations. As usual, Henry is correct. However, speaking as a partisan of ADT design techniques who likes to build entire program systems as collections of live data types, I avoid passing structs anyhow. Pointers are significantly faster to hand around and cheaper to store. Of course this is not a problem if your type is int size or less. A struct consisting of two short ints (useful in graphics work, for example) is an excellent candidate to be passed around by value rather than by address. -- Eric S. Raymond = eric@snark.uu.net (mad mastermind of TMN-Netnews)