| |||
| Home > Compiler Command-line Options > --pointer_alignment=num | |||
This option specifies the unaligned pointer support required for an application.
--pointer_alignment=num
Where is one
of: num
1Treats accesses through pointers as having an alignment of one, that is, byte-aligned or unaligned.
2Treats accesses through pointers as having an alignment of at most two, that is, at most halfword aligned.
4Treats accesses through pointers as having an alignment of at most four, that is, at most word aligned.
8Accesses through pointers have normal alignment, that is, at most doubleword aligned.
If is
unspecified, the compiler faults use of num --pointer_alignment.
This option can help you port source code that has been written
for architectures without alignment requirements. You can achieve
finer control of access to unaligned data, with less impact on the
quality of generated code, using the __packed qualifier.
De-aligning pointers might increase the code size, even on CPUs with unaligned access support. This is because only a subset of the load and store instructions benefit from unaligned access support. The compiler is unable to use multiple-word transfers or coprocessor-memory transfers, including hardware floating-point loads and stores, directly on unaligned memory objects.
Code size might increase significantly when compiling for CPUs without hardware support for unaligned access, for example, pre-v6 architectures.
This option does not affect the placement of objects in memory, nor the layout and padding of structures.
Compiler storage of data objects by natural byte alignment in Using the Compiler.