| Syntax: | Default: |
| gen(align, option) | gen(align, power) |
This option specifies which aggregate alignment rules VisualAge C++ applies to a build target. Use this option to specify the maximum alignment to be used when mapping a class-type object, either for the whole source program or for specific parts.
The default is gen(align, power).
The align suboptions are described in the following table.
| power | Use the RISC System/6000 alignment rules. |
| full | Use the RISC System/6000 alignment rules. The power option is the same as full. |
| mac68k | Use the Macintosh** alignment rules. |
| twobyte | Use the Macintosh alignment rules. The mac68k option is the same as twobyte. |
| packed | Use the packed alignment rules. |
| natural | Map structure members to their natural boundaries. This has the same effect as the power suboption, except that it also applies alignment rules to doubles and long doubles that are not the first member of a structure or union. |
If you use the gen(align) option more than once, the last alignment rule specified applies.
You can also specify alignment options by using #pragma options align=option. The pragma overrides the configuration file option.
Within your source file, you can also use #pragma options align=reset to revert to a previous alignment rule. VisualAge C++ stacks other alignment directives, so you can go back to using the previous alignment directive, without knowing what it is, by specifying the #pragma align=reset directive. If no previous alignment rule appears in the file, the alignment rule specified in the invocation command is used. For example, you can use this option if you have a class declaration within an include file and you do not want the alignment rule specified for the class to apply to the file in which the class is included.
![]()
On the OS/2 and Windows NT platforms,
use the gen(pack) option to align data items within
structures.
Example 1 - Embedded #pragmas
Applying the gen(align, mac68k) option, so that the Macintosh alignment rules are used by default, to a target with the following source code:
struct A {
int a;
struct B {
char c;
double d;
#pragma options align=power /* <-- B will be unaffected by this */
/* #pragma, unlike previous behavior; */
/* Macintosh alignment rules still */
/* in effect */
} BB;
#pragma options align=reset /* <-- A unaffected by this #pragma; */
} AA; /* Macintosh alignment rules still */
/* in effect */
Example 2 - Affecting Only Aggregate Definition
Allowing the default gen(align, power) option to apply, so that the RISC System/6000 alignment rules are used, to a target with the following source code:
extern struct A A1;
typedef struct A A2;
#pragma options align=packed /* <-- use packed alignment rules
*/
struct A {
int a;
char c;
};
#pragma options align=reset /* <-- Go back to default alignment rules */
struct A A1; /* <-- aligned using packed alignment rules since
*/
A2 A3; /* this rule
applied when struct A was defined */
![]()
Incremental C++ Build
C Compilation
Configuration Files
![]()
Sections and Segments
![]()
Code
Generation Options
![]()
Code Generation Options
