Alignment - Structures and Other Things
kevin diggs
diggskevin38@gmail.com
Wed Apr 13 19:56:00 GMT 2011
Hi,
On Wed, Apr 13, 2011 at 2:26 PM, Andrew Bell <andrew.bell.ia@gmail.com> wrote:
>
> malloc() will return memory on a boundary suitable for any type. If
> some types must be, say, 8-byte aligned, malloc will return memory
> that is 8-byte aligned. This of course satisfies types that are
> 4-byte, 2-byte and non-aligned.
>
> Your example code will end up breaking on some systems.
>
Even if it doesn't break it will likely incur a performance penalty
from unaligned accesses, right?
> --
> Andrew Bell
> andrew.bell.ia@gmail.com
>
More information about the Gcc-help
mailing list