-qalignrulefor (C++ only)
Category
Pragma equivalent
None
Purpose
When used with -qalign=power, determines whether a 4-byte alignment ceiling is applied to non-first members of structures that are of type typedef to array of element type that exceeds the alignment ceiling.
Defaults
-qalignrulefor=power=typedefrespectsrule
Parameters
- typedefrespectsrule | notypedefrespectsrule
- When typedefrespectsrule is in effect, the member
follows the normal alignment rules for -qalign=power. This suboption provides compatibility with code compiled with -qalign=power with XL C++ V6.0 and earlier.
For XL C++ V9.0, the default is typedefrespectsrule.
When notypedefrespectsrule is in effect, a member that exceeds the alignment ceiling of 4 bytes is aligned on 4-byte boundaries. This suboption provides compatibility with code compiled with -qalign=power with XL C++ V7.0 and V8.0.
Predefined macros
None.
Examples
The following example uses a typedef declaration for an array of structures containing a member of long long type, which is not normally subject to a 4-byte alignment ceiling, and then uses the typedef as the non-first member of a structure variable declaration. The table shows the differing alignment results depending on the setting of the -qalignrulefor=power option.
| Sample code | Alignment results | |
|---|---|---|
| typedefrespectsrule | notypedefrespectsrule | |
struct A { |
alignment of b.ten_a = 8 |
alignment of b.ten_a = 8 |



