Mail Archives: djgpp/1995/08/01/00:16:49
Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:
: On Fri, 28 Jul 1995, A.Appleyard wrote:
: > Why not pack structs etc anyway by default? On a PC, (rounding every member's
: > width to a multiple of 2 or 4 bytes) achieves nothing except wasting store and
: > annoying people who want to make a struct match some assembly-coded table (as
: > e.g. when calling some interrupts).
: This is not true. There is a considerable penalty on a 486 or better CPU
: for unaligned accesses, so even on a PC struct padding makes a lot of
I think what was originally intended, was that shorts were 2-byte
aligned and ints where 4-byte aligned. As you would expect, a multiple of
2 shorts must be used consecutively to preserve int alignment (otherwise
gcc must pad a short). This then would work intuitively.
Junaid
- Raw text -