Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA
Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!packard!edsel!bentley!hoxna!houxm!mhuxr!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!gwyn
From: gwyn@brl-tgr.ARPA (Doug Gwyn )
Newsgroups: net.lang.c
Subject: Re: The one and only objection to C
Message-ID: <6769@brl-tgr.ARPA>
Date: Wed, 26-Dec-84 00:06:35 EST
Article-I.D.: brl-tgr.6769
Posted: Wed Dec 26 00:06:35 1984
Date-Received: Thu, 27-Dec-84 03:30:32 EST
References: <69@galbp.UUCP>
Organization: Ballistic Research Lab
Lines: 17

> why in the world does most C compilers insist on padding structures?

On some architectures, there are alignment restrictions such that data
of a particular type must be stored at an address that is a multiple
of some number of bytes, in order to be directly accessible; e.g., on a
PDP-11 all non-char data must be stored at an even-byte address.  The C
run-time environment designer takes these and other things into account
when deciding how to align structure members.

On a fully byte-addressable machine, no struct padding should be used.

On the VAX, a silly decision was made.  In spite of the fact that there
are no alignment constraints imposed by the architecture, the VAX PCC
implementors nevertheless chose to align data in order to take into
account the way the 11/780 cache was designed.  The idea was to squeeze
a small speed improvement out of the VAX-11/780.  I wonder if the scheme
continued to accomplish its goal on other VAX models?