XL C/C++ Advanced Edition is an optimizing, standards-based, command-line compiler for the Linux operating system running on the PowerPC(R) architecture. The compiler is a professional programming tool for creating and maintaining 32-bit and 64-bit applications in the extended C and C++ programming languages.
This document introduces you to the XL C/C++ compiler. It describes the various compiler invocations and ways to customize the compilation environment and control the compilation process. This document contains descriptions of the types of transformations the compiler can perform, the accepted file types for input and output, categorized summaries of compiler options, and considerations for porting an existing application. This document also provides a brief introduction to optimizing the performance of your applications. The optimizing capabilities of the compiler enable you to exploit the multilayered architecture of the PowerPC processor.
Linux and AIX(R) are complementary operating systems. If you are familiar with IBM C for AIX or VisualAge(R) C++ Professional for AIX, your makefiles can be readily adapted to work on the Linux platform. If you are new to the IBM C and C++ compilers, this document can open a path to improved performance during compile, link, and run time.
This document assumes that you are familiar with the C and C++ programming languages, the Linux operating system, and the bash shell.
Examples are intended to be instructional and do not attempt to minimize run time, conserve storage, or check for errors. The examples do not demonstrate all of the possible uses of the language constructs. Some examples are only code fragments and will not compile without additional code.
The >>--- symbol indicates the beginning of a command, directive, or statement.
The ---> symbol indicates that the command, directive, or statement syntax is continued on the next line.
The >--- symbol indicates that a command, directive, or statement is continued from the previous line.
The --->< symbol indicates the end of a command, directive, or statement.
Diagrams of syntactical units other than complete commands, directives, or statements start with the >--- symbol and end with the ---> symbol.
>>-statement--required_item------------------------------------><
>>-statement--+---------------+-------------------------------->< '-optional_item-'
If you must choose one of the items, one item of the stack appears on the main path.
>>-statement--+-required_choice1-+----------------------------->< '-required_choice2-'
If choosing one of the items is optional, the entire stack appears below the main path.
>>-statement--+------------------+----------------------------->< +-optional_choice1-+ '-optional_choice2-'
The item that is the default appears above the main path.
.-default_item---. >>-statement--+-alternate_item-+-------------------------------><
.-----------------. V | >>-statement----repeatable_item-+------------------------------><
A repeat arrow above a stack indicates that you can make more than one choice from the stacked items, or repeat a single choice.
Variables appear in italicized lowercase letters (for example, identifier). They represent user-supplied names or values.
The following syntax diagram example shows the syntax for the #pragma comment directive. See XL C/C++ Language Reference for information on the #pragma directive.
(1) (2) (3) (4) (5) (6) (9) (10) >>-#--pragma--comment--(-------compiler---------------------------)->< | | +-----date----------------------------+ | | +-----timestamp-----------------------+ | | +--+--copyright--+--+-----------------+ | | | | +--user-------+ +--,-"characters"-+ (7) (8)
(1) This is the start of the syntax diagram.
(2) The symbol # must appear first.
(3) The keyword pragma must appear following the # symbol.
(4) The name of the pragma comment must appear following the keyword pragma.
(5) An opening parenthesis must be present.
(6) The comment type must be entered only as one of the types indicated: compiler, date, timestamp, copyright, or user.
(7) A comma must appear between the comment type copyright or user, and an optional character string.
(8) A character string must follow the comma. The character string must be enclosed in double quotation marks.
(9) A closing parenthesis is required.
(10) This is the end of the syntax diagram.
The following examples of the #pragma comment directive are syntactically correct according to the diagram shown above:
#pragma comment(date) #pragma comment(user) #pragma comment(copyright,"This text will appear in the module")