home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / c / 2368 < prev    next >
Encoding:
Text File  |  1992-07-27  |  963 b   |  31 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: Character arrays in structures and address alignment -- any standard?
  5. Message-ID: <1992Jul27.183622.794@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Jul26.225252.4487@anasazi.com>
  8. Date: Mon, 27 Jul 1992 18:36:22 GMT
  9. Lines: 20
  10.  
  11. duane@anasazi.com (Duane Morse) writes:
  12.  
  13. |  struct {
  14. |    char a[3];
  15. |    char b[2];
  16. |  } x;
  17.  
  18. |On the 5 different Unix machines in our building, 'b' always starts 3
  19. |bytes after 'a'; the compiler is smart enough to know that it is both
  20. |legal and proper to leave the start of 'b' on an odd byte boundary.
  21.  
  22. |But is that a standard or a requirement?
  23.  
  24. The Standard allows arbitrary padding between fields and after the
  25. last field.  You cannot rely on the offset of member 'b' being the
  26. same on different implementations.
  27. -- 
  28.  
  29. Steve Clamage, TauMetric Corp, steve@taumet.com
  30. Vice Chair, ANSI C++ Committee, X3J16
  31.