home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16922 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  1.2 KB

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!allegra!alice!ark
  2. From: ark@alice.att.com (Andrew Koenig)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is this ANSI?
  5. Message-ID: <24262@alice.att.com>
  6. Date: 20 Nov 92 23:03:04 GMT
  7. Article-I.D.: alice.24262
  8. References: <9eRguB1w165w@quest.UUCP> <24238@alice.att.com> <By0vu2.7AF@unx.sas.com>
  9. Reply-To: ark@alice.UUCP ()
  10. Organization: AT&T Bell Laboratories, Murray Hill NJ
  11. Lines: 26
  12.  
  13. In article <By0vu2.7AF@unx.sas.com> sasghm@theseus.unx.sas.com (Gary Merrill) writes:
  14.  
  15. > I think "does not allow that technique" is a little strong.  What you
  16. > *can* do is
  17.  
  18.     struct FM
  19.     {
  20.        short data_len;
  21.        char  data[1];
  22.         };
  23.  
  24.     struct FM *fmptr;
  25.  
  26.     fmptr = malloc( sizeof(struct FM) + ??? );
  27.  
  28. > where the ??? is the number of bytes of your data minus 1.  Some may
  29. > regard this as "impure", but it is not forbidden by the standard and
  30. > is eminently portable.
  31.  
  32. Oh, really?  Can you give me concrete evidence that the C standard allows it?
  33.  
  34. More specifically, after executing the code above, can you give me
  35. evidence that referrint to fmptr->data[i] is allowed when i>1?
  36. -- 
  37.                 --Andrew Koenig
  38.                   ark@europa.att.com
  39.