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

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!cs.utexas.edu!asuvax!ennews!anasaz!duane
  3. From: duane@anasazi.com (Duane Morse)
  4. Subject: Character arrays in structures and address alignment -- any standard?
  5. Message-ID: <1992Jul26.225252.4487@anasazi.com>
  6. Sender: usenet@anasazi.com (Usenet News)
  7. Organization: Anasazi Inc, Phoenix AZ USA
  8. Date: Sun, 26 Jul 1992 22:52:52 GMT
  9. Lines: 20
  10.  
  11. Consider
  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?  In other words, is it really
  23. portable to send a structure of purely character data to another machine
  24. without taking it apart first to insure that one doesn't send 'filler'
  25. bytes too?
  26.  
  27. -- 
  28.  
  29. Duane Morse    e-mail: duane@anasazi.com
  30. (602) 861-7609
  31.