home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!Xenon.Stanford.EDU!amorgan
- From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
- Subject: Re: Variable length records
- Message-ID: <1992Jul27.214517.8281@CSD-NewsHost.Stanford.EDU>
- Sender: news@CSD-NewsHost.Stanford.EDU
- Organization: Computer Science Department, Stanford University.
- References: <24137@castle.ed.ac.uk> <rbjmzg-.gurgle@netcom.com> <1992Jul25.091702.15993@klaava.Helsinki.FI>
- Date: Mon, 27 Jul 1992 21:45:17 GMT
- Lines: 31
-
- wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
- >gurgle@netcom.com (Pete Gontier) writes:
- >>typedef struct
- >>{
- >> short count;
- >> float data[ ];
- >>}
- >>foo;
- >>
- >>I refer to the second member as an "open array." Its behavior is this:
- >> o it may appear only as the last member of a structure
- >> o it does not contribute to the value returned by sizeof(foo)
- >> o it may be addressed, of course, with an arbitrary index
- >
- >My gcc 2.2.2 under Linux doesn't seem to support it, at least with the
- >default options:
- >
- > foo.c:3: field `data' has incomplete type
-
- But it *does* accept
-
- typedef struct
- {
- short count;
- float data[0];
- } foo;
-
- I have not *actually* checked this, but it is listed in the manual
- as a GNU extension, for the reasons others have discussed.
-
- C Frog
-