This preview shows page 1. Sign up to view the full content.
Unformatted text preview: type int, or any pointer, must be at an address having the low-order two bits equal to 0.
Aside: Alignment with Microsoft Windows. Microsoft Windows requires a stronger alignment requirement—any -byte (primitive) object must have an address that is a multiple of . In particular, it requires that the address of a double be a multiple of 8. This requirement enhances the memory performance at the expense of some wasted space. The design decision made in Linux was probably good for the i386, back when memory was scarce and memory busses were only 4 bytes wide. With modern processors, Microsoft’s alignment is a better design decision. The command line ﬂag -malign-double causes GCC on Linux to use 8-byte alignment for data of type double. This will lead to improved memory performance, but it can cause incompatibilities when linking with library code that has been compiled assuming a 4-byte alignment. End Aside. Alignment is enforced by making sure that every data type is organized and allocated in such a way that every object within the type satisﬁes its alignment rest...
View Full Document