.TH alignment "" "" Definition
.PC "Alignment or packing of fields within a structure"
.PP
.B Alignment
refers to the fact that some microprocessors require
the address of a data entity to be
.I aligned
to a numeric boundary in memory
so that \fIaddress\fR modulo \fInumber\fR equals zero.
For example, the M68000 and the PDP-11 require that
an integer be aligned along an even address, i.e.,
\fIaddress\fB%2==0\fR.
.II "packing"
In the \*(MD world, this is called ``packing''.
.PP
Generally speaking,
alignment is a problem only if you write programs in assembly language.
For C programs, \*(CO
ensures that data types are aligned properly under foreseeable conditions.
You should, however, beware of copying structures and of casting a pointer
to
.B char
to a pointer to a
.BR struct ,
for these could trigger alignment problems.
.PP
Processors react differently to an alignment problem.
On the VAX or the i8086, it causes a program to run more slowly,
whereas on the M68000 it causes a bus error.
.SH "See Also"
.Xr #pragma, _23pragma
.Xr "data types," data_type
.Xr ld, ld
.Xr "Programming COHERENT" programmi
.SH Notes
The \*(CO preprocessor instruction
.B #pragma
lets you set alignment to conform to Intel's Binary Compatibility
Standard (BCS).
For details, see the Lexicon entry for
.BR #pragma .
