🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #126

Character arrays in structures and address alignment -- any standard?

#126
From: Duane Morse
Date: Sun, 26 Jul 1992 22:52
20 lines
961 bytes
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
Technical Details
Message-ID: <1992Jul26.225252.4487@anasazi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!asuvax!ennews!anasaz!duane

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!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