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