home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11650 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.3 KB  |  43 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!Xenon.Stanford.EDU!amorgan
  3. From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
  4. Subject: Re: Variable length records
  5. Message-ID: <1992Jul27.214517.8281@CSD-NewsHost.Stanford.EDU>
  6. Sender: news@CSD-NewsHost.Stanford.EDU
  7. Organization: Computer Science Department, Stanford University.
  8. References: <24137@castle.ed.ac.uk> <rbjmzg-.gurgle@netcom.com> <1992Jul25.091702.15993@klaava.Helsinki.FI>
  9. Date: Mon, 27 Jul 1992 21:45:17 GMT
  10. Lines: 31
  11.  
  12. wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
  13. >gurgle@netcom.com (Pete Gontier) writes:
  14. >>typedef struct
  15. >>{
  16. >>    short   count;
  17. >>   float   data[ ];
  18. >>}
  19. >>foo;
  20. >>
  21. >>I refer to the second member as an "open array." Its behavior is this:
  22. >>    o  it may appear only as the last member of a structure
  23. >>    o  it does not contribute to the value returned by sizeof(foo)
  24. >>   o  it may be addressed, of course, with an arbitrary index
  25. >
  26. >My gcc 2.2.2 under Linux doesn't seem to support it, at least with the
  27. >default options:
  28. >
  29. >    foo.c:3: field `data' has incomplete type
  30.  
  31. But it *does* accept
  32.  
  33. typedef struct
  34. {
  35.     short count;
  36.     float data[0];
  37. } foo;
  38.  
  39. I have not *actually* checked this, but it is listed in the manual
  40. as a GNU extension, for the reasons others have discussed.
  41.  
  42. C Frog
  43.