home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!cs.utexas.edu!asuvax!ennews!anasaz!duane
- From: duane@anasazi.com (Duane Morse)
- Subject: Character arrays in structures and address alignment -- any standard?
- Message-ID: <1992Jul26.225252.4487@anasazi.com>
- Sender: usenet@anasazi.com (Usenet News)
- Organization: Anasazi Inc, Phoenix AZ USA
- Date: Sun, 26 Jul 1992 22:52:52 GMT
- Lines: 20
-
- Consider
-
- struct {
- char a[3];
- char b[2];
- } x;
-
- On the 5 different Unix machines in our building, 'b' always starts 3
- bytes after 'a'; the compiler is smart enough to know that it is both
- legal and proper to leave the start of 'b' on an odd byte boundary.
-
- But is that a standard or a requirement? In other words, is it really
- portable to send a structure of purely character data to another machine
- without taking it apart first to insure that one doesn't send 'filler'
- bytes too?
-
- --
-
- Duane Morse e-mail: duane@anasazi.com
- (602) 861-7609
-