XL C/C++ Programming Guide
IBM XL C/C++ Enterprise Edition V8.0 for AIX Programming Guide SC09-7996-00 … pages are provided in the IBM XL C/C++ Enterprise Edition V8.0 for AIX Installation Guide . v …
This guide discusses advanced topics related to the use of the IBM? XL C/C++ Enterprise Edition for AIX? compiler, with a particular focus on program portability and optimization. The guide provides both reference information and practical tips for getting the most out of the compiler’s capabilities, through recommended programming practices and compilation procedures. Aligning data. XL C/C++ provides many mechanisms for specifying data alignment at the levels of individual variables, members of aggregates, entire aggregates, and entire compilation units. If you are porting applications between different platforms, or between 32-bit and 64-bit modes, you will need to take into account the differences between alignment settings available in the different environments, to prevent possible data corruption and deterioration in performance. In particular, vector types have special alignment requirements which, if not followed, can produce incorrect results. Alignment modes allow you to set alignment defaults for all data types for a compilation unit (or subsection of a compilation unit), by specifying a predefined suboption. Alignment modifiers allow you to set the alignment for specific variables or data types within a compilation unit, by specifying the exact number of bytes that should be used for the alignment. “Using alignment modes” discusses the default alignment modes for all data types on the different platforms and addressing models; the suboptions and pragmas you can use to change or override the defaults; and rules for the alignment modes for simple variables, aggregates, and bit fields. This section also provides examples of aggregate layouts based on the different alignment modes. “Using alignment modifiers” on page 15 discusses the different specifiers, pragmas, and attributes you can use in your source code to override the alignment mode currently in effect, for specific variable declarations. It also provides the rules governing the precedence of alignment modes and modifiers during compilation. Using alignment modes. Each data type supported by XL C/C++ is aligned along byte boundaries according to platform-specific default alignment modes, as follows:•AIX: power or full, which are equivalent. •Linux: linuxppc. You can change the default alignment mode, by using any of the following mechanisms: Set the alignment mode for all variables in a single file or multiple files during compilation. To use this approach, you specify the -qalign compiler option during compilation, with one of the suboptions listed in Table 10 on page 10. Set the alignment mode for all variables in a section of source code. To use this approach, you specify the #pragma align or #pragma options align directives in the source files, with one of the suboptions listed in Table 10 on page 10. Each directive changes the…
Source: http://www.bluefern.canterbury.ac.nz/
Download XL C/C++ Programming Guide
Leave a Reply