home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11716 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  1.3 KB

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Variable length records
  5. Date: 29 Jul 1992 18:27:56 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 18
  8. Message-ID: <156nvcINNecv@early-bird.think.com>
  9. References: <rbjmzg-.gurgle@netcom.com> <1992Jul25.091702.15993@klaava.Helsinki.FI> <1992Jul29.160618.27224@klaava.Helsinki.FI>
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1992Jul29.160618.27224@klaava.Helsinki.FI> wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
  13. >One point which I didn't think of until now (and which doesn't seem to
  14. >have been pointed out by others) is that the '[]' and '[1]' versions
  15. >don't allow using the structures as values, like for assignment,
  16. >parameter passing and returning as function values.
  17.  
  18. But if you want the contents of the array portion to be copied in such
  19. contexts, neither does your char* version.  With the [] and [1] versions
  20. you can do the assignment using a single bcopy(), while with the char*
  21. version you'd have to assign the structure, malloc() a new array, and then
  22. bcopy() the old array into the new array.
  23.  
  24. Both approaches have their merits and misfeatures.
  25. -- 
  26. Barry Margolin
  27. System Manager, Thinking Machines Corp.
  28.  
  29. barmar@think.com          {uunet,harvard}!think!barmar
  30.