home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: Character arrays in structures and address alignment -- any standard?
- Message-ID: <1992Jul27.183622.794@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Jul26.225252.4487@anasazi.com>
- Date: Mon, 27 Jul 1992 18:36:22 GMT
- Lines: 20
-
- duane@anasazi.com (Duane Morse) writes:
-
- | 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?
-
- The Standard allows arbitrary padding between fields and after the
- last field. You cannot rely on the offset of member 'b' being the
- same on different implementations.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-