ILE C Compiler Reference
ILE C Compiler Reference
Edition notice
This edition applies to IBM i 7.1, (program 5770–WDS), ILE C/C++ compilers, and to all subsequent releases and
modifications until otherwise indicated in new editions. This version does not run on all reduced instruction set
computer (RISC) models nor does it run on CISC models.
© Copyright IBM Corporation 1993, 2010.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
About ILE C/C++ Compiler Reference pointer . . . . . . . . . . . . . . . 63
(SC09-4816) . . . . . . . . . . . . . v priority . . . . . . . . . . . . . . . 64
Who Should Read This Book . . . . . . . . . v sequence . . . . . . . . . . . . . . 65
Prerequisite and Related Information . . . . . . v strings . . . . . . . . . . . . . . . 66
Install Licensed Program Information . . . . . . v weak . . . . . . . . . . . . . . . 67
A Note About Examples . . . . . . . . . . v
Control Language Commands . . . . . . . . v Chapter 3. Control Language
How to Read the Syntax Diagrams. . . . . . . vi Commands . . . . . . . . . . . . . 69
How to Send Your Comments . . . . . . . . vii Control Language Command Syntax . . . . .
. 69
What is new for IBM i 7.1 . . . . . . . . . viii Control Language Command Options . . . .
. 76
MODULE . . . . . . . . . . . . .
. 76
Chapter 1. Predefined Macros . . . . . 1 PGM . . . . . . . . . . . . . .
. 76
ANSI/ISO Standard Predefined Macros . . . . . 1 SRCFILE . . . . . . . . . . . . .
. 77
ILE C/C++ Predefined Macros . . . . . . . . 2 SRCMBR . . . . . . . . . . . . .
. 78
SRCSTMF . . . . . . . . . . . . .
. 79
Chapter 2. ILE C/C++ Pragmas . . . . . 7 TEXT . . . . . . . . . . . . . .
. 80
OUTPUT . . . . . . . . . . . . .
. 81
| Pragma directive syntax . . . . . . . . . . 7
OPTION . . . . . . . . . . . . .
. 82
| Scope of Pragma directives . . . . . . . . . 8
CHECKOUT . . . . . . . . . . . .
. 88
Summary of Pragma Directives . . . . . . . . 9
OPTIMIZE. . . . . . . . . . . . .
. 91
Individual Pragma Descriptions . . . . . . . 11
INLINE. . . . . . . . . . . . . .
. 92
argopt . . . . . . . . . . . . . . . 11
MODCRTOPT . . . . . . . . . . .
. 94
argument . . . . . . . . . . . . . . 13
DBGVIEW . . . . . . . . . . . . .
. 95
cancel_handler . . . . . . . . . . . . 15
chars . . . . . . . . . . . . . . . 16
| DBGENCKEY . . . . . . . . . . .
. 96
DEFINE . . . . . . . . . . . . .
. 97
checkout . . . . . . . . . . . . . . 17
LANGLVL. . . . . . . . . . . . .
. 98
comment . . . . . . . . . . . . . . 18
convert . . . . . . . . . . . . . . . 19
| ALIAS . . . . . . . . . . . . . .
. 99
SYSIFCOPT . . . . . . . . . . . . . 100
datamodel . . . . . . . . . . . . . . 20
LOCALETYPE . . . . . . . . . . . . 101
define . . . . . . . . . . . . . . . 21
FLAG . . . . . . . . . . . . . . . 102
descriptor . . . . . . . . . . . . . . 22
MSGLMT. . . . . . . . . . . . . . 103
disable_handler . . . . . . . . . . . . 24
REPLACE . . . . . . . . . . . . . 104
disjoint . . . . . . . . . . . . . . . 25
USRPRF . . . . . . . . . . . . . . 105
| do_not_instantiate . . . . . . . . . . . 26
AUT . . . . . . . . . . . . . . . 106
enum . . . . . . . . . . . . . . . 27
TGTRLS . . . . . . . . . . . . . . 107
exception_handler . . . . . . . . . . . 31
ENBPFRCOL . . . . . . . . . . . . 108
hashome . . . . . . . . . . . . . . 34
PFROPT . . . . . . . . . . . . . . 109
implementation . . . . . . . . . . . . 35
PRFDTA . . . . . . . . . . . . . . 110
info . . . . . . . . . . . . . . . . 36
TERASPACE. . . . . . . . . . . . . 111
inline . . . . . . . . . . . . . . . 37
STGMDL . . . . . . . . . . . . . . 114
ishome . . . . . . . . . . . . . . . 38
DTAMDL. . . . . . . . . . . . . . 115
isolated_call . . . . . . . . . . . . . 39
RTBND . . . . . . . . . . . . . . 116
linkage . . . . . . . . . . . . . . . 40
PACKSTRUCT . . . . . . . . . . . . 117
map . . . . . . . . . . . . . . . . 42
ENUM . . . . . . . . . . . . . . 118
mapinc . . . . . . . . . . . . . . . 44
MAKEDEP . . . . . . . . . . . . . 119
margins . . . . . . . . . . . . . . 46
PPGENOPT . . . . . . . . . . . . . 120
namemangling . . . . . . . . . . . . 47
PPSRCFILE . . . . . . . . . . . . . 121
| namemanglingrule . . . . . . . . . . . 48
PPSRCMBR . . . . . . . . . . . . . 122
noargv0 . . . . . . . . . . . . . . 50
PPSRCSTMF. . . . . . . . . . . . . 123
noinline (function) . . . . . . . . . . . 51
INCDIR . . . . . . . . . . . . . . 124
nomargins . . . . . . . . . . . . . . 52
CSOPT . . . . . . . . . . . . . . 125
nosequence . . . . . . . . . . . . . 53
LICOPT . . . . . . . . . . . . . . 126
nosigtrunc . . . . . . . . . . . . . . 54
DFTCHAR . . . . . . . . . . . . . 127
pack . . . . . . . . . . . . . . . . 55
TGTCCSID . . . . . . . . . . . . . 128
page . . . . . . . . . . . . . . . . 61
TEMPLATE . . . . . . . . . . . . . 129
pagesize . . . . . . . . . . . . . . 62
The IBM i Information Center contains new and updated system information, such as software
installation, Linux, WebSphere®, Java™, high availability, database, logical partitions, CL commands, and
system application programming interfaces (APIs). In addition, it provides advisors and finders to assist
in planning, troubleshooting, and configuring your system hardware and software.
For more information about CL commands, see the CL and APIs section in the Programming category at
the IBM i Information Center web site:
http://www.ibm.com/systems/i/infocenter
You need object authority to use CL commands. For more information about object authority, see the
Planning and setting up system security section in the Security category at the Information Center Web site.
Note: In the following diagrams, statement represents a C or C++ command, directive, or statement.
v Required items appear on the horizontal line (the main path).
►► statement required_item ►◄
►► statement ►◄
optional_item
v If you can choose from two or more items, they appear vertically, in a stack.
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 An arrow returning to the left above the main line indicates an item that can be repeated.
►► 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.
v Keywords appear in nonitalic letters and should be entered exactly as shown (for example, extern).
Variables appear in italicized lowercase letters (for example, identifier). They represent user-supplied
names or values.
v If punctuation marks, parentheses, arithmetic operators, or other such symbols are shown, you must
enter them as part of the syntax.
▌7▐ ▌8▐
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")
where:
v Mmm represents the month in an abbreviated form (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug,
Sep, Oct, Nov, or Dec).
v dd represents the day. If the day is less than 10, the first d is a blank character.
v yyyy represents the year.
__FILE__ Defined as a character string literal containing the name of the source file.
__LINE__ Defined to be an integer representing the current source line number.
| __STDC__ Defined if the C compiler conforms to the ANSI standard. This macro is
| defined if the language level is set to LANGLVL(*ANSI).
| __STDC_VERSION__
| Defined to be an integer constant of type long int. This macro is defined only if
| __STDC__ is also defined and has the value 199409L. This macro is not defined for C++.
__TIME__ Defined as a character string literal containing the time when the source file was
compiled. The time is in the form:
"hh:mm:ss"
where:
v hh represents the hour.
v mm represents the minutes.
v ss represents the seconds.
__cplusplus Defined when compiling a C++ program, indicating that the compiler is a C++
compiler. This macro has no trailing underscores. This macro is not defined for C.
Notes:
1. Predefined macro names cannot be the subject of a #define or #undef preprocessor directive.
2. The predefined ANSI/ISO Standard macro names consist of two underscore (__) characters
immediately preceding the name, the name in uppercase letters, and two underscore characters
immediately following the name.
3. The value of __LINE__ changes during compilation as the compiler processes subsequent lines of your
source program.
4. The value of __FILE__ and __TIME__ changes as the compiler processes any #include files that are part
of your source program.
5. You can also change __LINE__ and __FILE__ using the #line preprocessor directive.
The following printf() statements display the values of the predefined macros __LINE__, __FILE__,
__TIME__, and __DATE__ and print a message indicating if the program conforms to ANSI standards based
on __STDC__:
#include <stdio.h>
#ifdef __STDC__
# define CONFORM "conforms"
#else
# define CONFORM "does not conform"
#endif
int main(void)
{
printf("Line %d of file %s has been executed\n", __LINE__, __FILE__);
printf("This file was compiled at %s on %s\n", __TIME__, __DATE__);
printf("This program %s to ANSI standards\n", CONFORM);
}
Related Information
| See IBM Rational® Developer for i: ILE C/C++ Language Reference, SC09-7852-01 for additional information
| on predefined macros.
| where:
| Day represents the day of the week (Mon, Tue, Wed, Thu, Fri, Sat, or Sun).
| Mmm represents the month in an abbreviated form (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug,
| Sep, Oct, Nov, or Dec).
| dd represents the day. If the day is less than 10, the first d is a blank character.
| hh represents the hour.
| mm represents the minutes.
| ss represents the seconds.
| yyyy represents the year.
| Note: Other compilers might not support this macro. If the macro is supported on other
| compilers, the date and time values might be different from the values shown here.
| __TOS_OS400__ Indicates that the target operating system is i5/OS.
| __UCS2__ Defined when the LOCALETYPE(*LOCALEUCS2) compiler option is specified.
| __UTF32__ Defined when the LOCALETYPE(*LOCALEUTF) compiler option is specified.
| __wchar_t Indicates that the typedef wchar_t has been defined.
| This macro is defined in the standard header file stddef.h.
| #pragma name
| The name is the pragma directive name, and the suboptions are any required or optional suboptions that
| can be specified for the pragma, where applicable.
| _Pragma ("name")
| _Pragma("name") syntax
| is equivalent to:
| #pragma pack(1)
| For all forms of pragma statements, you can specify more than one name and suboptions in a single
| #pragma statement.
| The name on a pragma is subject to macro substitutions, unless otherwise stated. The compiler ignores
| unrecognized pragmas, issuing an informational message (C++) or warning message (C) indicating the
| unrecognized pragma.
| If you have any pragmas that are not common to both C and C++ in code that is compiled by both
| compilers, you should add conditional compilation directives around the pragmas. (These directives are
| not strictly necessary since unrecognized pragmas are ignored.) For example, #pragma info is only
| recognized by the C++ compiler, so you might decide to add conditional compilation directives around
| the pragma.
| #ifdef __cplusplus
| #pragma info(none)
| #endif
| In general, if you specify a pragma directive before any code in your source program, it applies to the
| entire compilation unit, including any header files that are included. For a directive that can appear
| anywhere in your source code, it applies from the point at which it is specified, until the end of the
| compilation unit.
| You can further restrict the scope of the application of a pragma by using complementary pairs of
| pragma directives around a selected section of code. For example, using #pragma datamodel directives as
| follows requests that only the selected parts of your source code use a particular data model setting:
| /* Data model may be P128 or LLP64 */
| #pragma datamodel(P128)
| /* Data model P128 is now in effect */
| #pragma datamodel(pop)
| /* Prior data model is now in effect */
| Many pragma directives provide "pop“ or "reset" suboptions that allow you to enable and disable pragma
| settings in a stack-based fashion; examples of these suboptions are provided in the relevant pragma
| descriptions.
“argopt” on page 11 U U
“argument” on page 13 U
“cancel_handler” on page 15 U U
“chars” on page 16 U U
“checkout” on page 17 U
“comment” on page 18 U U
“convert” on page 19 U
“datamodel” on page 20 U U
“define” on page 21 U
“descriptor” on page 22 U U
“disable_handler” on page 24 U U
“disjoint” on page 25 U
| “do_not_instantiate” on page 26 U
“enum” on page 27 U U
“exception_handler” on page 31 U U
“hashome” on page 34 U
“implementation” on page 35 U
“info” on page 36 U
“inline” on page 37 U
“ishome” on page 38 U
“isolated_call” on page 39 U
“linkage” on page 40 U
“map” on page 42 U U
“mapinc” on page 44 U
“margins” on page 46 U
“namemangling” on page 47 U
| “namemanglingrule” on page 48 U
“noargv0” on page 50 U
“noinline (function)” on page 51 U
“nomargins” on page 52 U
“nosequence” on page 53 U
“nosigtrunc” on page 54 U
“pack” on page 55 U U
“page” on page 61 U
“pagesize” on page 62 U
“pointer” on page 63 U U
“priority” on page 64 U
“sequence” on page 65 U
“strings” on page 66 U U
“weak” on page 67 U
argopt
argopt syntax
Description
Argument Optimization (argopt) is a pragma which might improve run-time performance. Applied to a
bound procedure, optimizations can be achieved by:
v Passing space pointer parameters into general-purpose registers (GPRs).
v Storing a space pointer returned from a function into a GPR.
Parameters
function_name Specifies the name of the function for which optimized procedure parameter passing is to
be specified. The function can be either a static function, an externally-defined function,
or a function defined in the current compilation unit that is called from outside the
current compilation unit.
typedef_of_function_name
Specifies the name of the typedef of the function for which optimized procedure
parameter passing is to be specified.
typedef_of_function_ptr
Specifies the name of the typedef of the function pointer for which optimized procedure
parameter passing is to be specified.
function_ptr Specifies the name of the function pointer for which optimized procedure parameter
passing is to be specified.
Notes on Usage
Specifying #pragma argopt directive does not guarantee that your program will be optimized.
Participation in argopt is dependent on the translator.
Do not specify #pragma argopt together with #pragma descriptor for the same declaration. The compiler
supports using only one or the other of these pragmas at a time.
A function must be declared (prototyped), or defined before it can be named in a #pragma argopt
directive.
Void pointers will not be optimized since they are not space pointers.
The #pragma argopt cannot be specified for functions which have OS-linkage or built-in linkage (for
functions which have a #pragma linkage (function_name, OS) directive or #pragma
linkage(function_name, builtin) directive associated with them, and vice versa).
The #pragma argopt must be placed in the same scope as the function, the function pointer, typedef of a
function pointer, or typedef of a function that it operates on. If the #pragma argopt is not in the same
scope, an error is issued.
#include <stdio.h>
long func3(long y)
{
printf("In func3()\n");
printf("hex=%x,integer=%d\n",y, y);
}
#pragma argopt (func3) /* file scope of function */
int main(void)
{
int i, a=0;
typedef long (*func_ptr) (long);
#pragma argopt (func_ptr) /* block scope of typedef */
/* of function pointer */
struct funcstr
{
long (*func_ptr2) (long);
#pragma argopt (func_ptr2) /* struct scope of function */
/* pointer */
};
struct funcstr func_ptr3;
for (i=0; i<99; i++)
{
a = i*i;
if (i == 7)
{
func_ptr3.func_ptr2( i );
}
}
return i;
}
argument syntax
Description
Specifies the argument passing and receiving mechanism to be used for the procedure or typedef named
by function_name.
This pragma identifies procedures as externally bound-procedures only. The procedure may be defined in
and called from the same source as the pragma argument directive. If the pragma argument directive is
specified in the same compilation unit as the definition of the procedure named in that directive, the
arguments to that procedure will be received using the method specified in that pragma directive.
For information about making calls to external programs, see pragma “linkage” on page 40.
Parameters
function_name Specifies the name of the externally-bound procedure.
OS OS indicates that arguments are passed, or received (if the pragma directive is in the
same compilation unit as the procedure definition), using the OS-Linkage argument
method. Non-address arguments are copied to temporary locations and widened (unless
nowiden has been specified), and the address of the copy is passed to the called
procedure. Arguments that are addresses or pointers are passed directly to the called
procedure.
VREF VREF is similar to OS-linkage with the exception that address arguments are also passed
and received using the OS-Linkage method.
nowiden Specifies that the arguments are not widened before they are passed or received. This
parameter can be used by itself without specifying an argument type. For example,
#pragma argument (myfunc, nowiden), indicates that procedure myfunc will pass and
receive its arguments with the typical by-value method, but unwidened.
Notes on Usage
This pragma controls how parameters are passed to bound-procedures and how they are received. The
function name specified in the #pragma argument directive can be defined in the current compilation
unit. The #pragma argument directive must precede the function it names.
Specifying a #pragma argument directive in the same compilation unit as the affected procedure tells the
compiler that the procedure is to receive (as well as to send) its arguments as specified in the pragma
argument directive. This is useful for ILE C written bound-procedures specified in a pragma argument.
The user must ensure that if the call to the procedure and the definition are in separate compilation units,
the pragma argument directives must match in regards to their passing method ( OS, VREF, and
nowiden).
Program 1 Program 2
#pragma argument( foo, OS, nowiden) #pragma argument( foo, OS, nowiden )
void foo(char); void foo( char a ) { a++; }
void main() {
foo(10);
}
Warnings are issued, and the #pragma argument directive is ignored if any of the following occurs:
v The #pragma argument directive does not precede the declaration or definition of the named function
in the compilation unit.
v The function_name in the directive is not the name of a procedure or a typedef of a procedure.
v A typedef named in the directive has been used in the declaration or definition of a procedure before
being used in the directive.
v A #pragma argument directive has already been specified for this function.
v A #pragma linkage directive or _System keyword has already been specified for this function.
v The function has already been called before the #pragma argument directive.
cancel_handler syntax
Description
Specifies that the function named is to be enabled as a user-defined ILE cancel handler at the point in the
code where the #pragma cancel_handler directive is located.
Any cancel handler that is enabled by a #pragma cancel_handler directive is implicitly disabled when the
call to the function containing the directive is finished. The call is removed from the call stack, if the
handler has not been explicitly disabled by the #pragma disable_handler directive.
Parameters
function_name Specifies the name of the function to be used as a user-defined ILE cancel handler.
com_area Used to pass information to the exception handler. If no com_area is required, specify zero
as the second parameter of the directive. If a com_area is specified on the directive, it must
be a variable of one of the following data types: integral, float, double, struct, union,
array, enum, pointer, or packed decimal. The com_area should be declared with the
volatile qualifier. It cannot be a member of a structure or a union.
See the C/C++ Runtime Library Functions for information about <except.h> and the typedef
_CNL_Hndlr_Parms_T, a pointer which is passed to the cancel handler.
Notes on Usage
This #pragma directive can only occur at a C language statement boundary and inside a function
definition.
chars syntax
unsigned
►► # pragma chars ( signed ) ►◄
Description
Specifies that the compiler is to treat all char objects as signed or unsigned. This pragma must appear
before any C code or directive (except for the #line directive) in a source file.
Parameters
unsigned All char objects are treated as unsigned integers.
signed All char objects are treated as signed integers.
checkout syntax
Description
| Specifies whether the compiler should give compiler information when a CHECKOUT compiler option
| value other than *NONE is specified.
Parameters
suspend Specifies that the compiler suspend informational messages.
resume Specifies that the compiler resume informational messages.
Notes on Usage
#pragma checkout directives can be nested. This means that a #pragma checkout (suspend) directive will
have no effect if a previously specified #pragma checkout (suspend) directive is still in effect. This is also
true for the #pragma checkout resume directive.
Example
/* Assume CHECKOUT(*PPTRACE) had been specified */
#pragma checkout(suspend) /* No CHECKOUT diagnostics are performed */
...
#pragma checkout(suspend) /* No effect */
...
#pragma checkout(resume) /* No effect */
...
#pragma checkout(resume) /* CHECKOUT(*PPTRACE) diagnostics continue */
comment syntax
Description
Emits a comment into the program or service program object. This can be shown by DSPPGM or
DSPSRVPGM with DETAIL(*COPYRIGHT). This pragma must appear before any C code or directive
(except for the #line directive) in a source file.
Parameters
Notes on Usage
The copyright and user comment types are virtually the same for the ILE C/C++ compiler. One has no
advantage over the other.
The maximum number of characters in the text portion of a #pragma comment(copyright) or #pragma
comment(user) directive is 256.
The maximum number of #pragma comment directives that can appear in a single compilation unit is
1024.
convert syntax
Description
Specifies the Coded Character Set Identifier (CCSID) to use for converting the string literals from that
point onward in a source file during compilation. The conversion continues until the end of the source
file or until another #pragma convert directive is specified. Use #pragma convert (0) to disable the
previous #pragma convert directive. The CCSID of the string literals before conversion is the same CCSID
as the root source member. CCSIDs 905 and 1026 are not supported. The CCSID can be either EBCDIC or
ASCII.
Parameters
ccsid Specifies the coded character set identifier to use for converting the strings and literals in
the source file. The value can be 0 - 65535. See the ILE C/C++ Runtime Library Functions
manual for more information about code pages.
Notes on Usage
| By default, runtime library functions that parse format strings (such as printf() and scanf()) expect the
| format strings to be coded in CCSID 37. If the LOCALETYPE(*LOCALEUTF) compile option is specified,
| then the runtime library functions expect the format strings to be coded in the CCSID of the last locale
| set in the program (or UTF-8 if the program does not set the locale).
String and character constants that are specified in hex, for example (0xC1), are not converted.
Substitution characters are not used when converting to a target CCSID that does not contain the same
symbol set as the source CCSID. The compilation fails.
If a CCSID with the value 65535 is specified, the CCSID of the root source member is assumed. If the
source file CCSID value is 65535, the job CCSID is assumed for the source file. If the file CCSID is 65535
and the job CCSID is not 65535, the job CCSID is assumed for the file CCSID. If the file is 65535 and the
job is also 65535, but the system CCSID value is not 65535, the system CCSID value is assumed for the
file CCSID. If the file, job and system CCSID values are 65535, CCSID 037 is assumed.
datamodel syntax
P128
►► # pragma datamodel ( LLP64 ) ►◄
pop
Description
Specifies a data model to apply to a section of code. The data model setting determines the interpretation
of pointer types in absence of an explicit modifier.
This pragma overrides the data model specified by the DTAMDL compiler command line option.
Parameters
P128, p128 The size of pointers declared without the __ptr64 keyword will be 16 bytes.
LLP64, llp64 The size of pointers declared without the __ptr128 keyword will be 8 bytes.
pop Restores the previous data model setting. If there is no previous data model setting, the
setting specifed by the DTAMDL compiler command line option is used.
Note on Usage
This pragma and its settings are case-sensitive when used in C++ programs.
Specifying #pragma datamodel(LLP64) or #pragma datamodel(llp64) has effect only when the
TERASPACE(*YES) compiler option is also specified.
The data model specified by this pragma remains in effect until another data model is specified, or until
#pragma datamodel(pop) is specified.
Example
This pragma is recommended for wrapping header files, without having to add pointer modifiers to
pointer declarations. For example:
// header file blah.h
#pragma datamodel(P128) // Pointers are now 16-byte
char* Blah(int, char *);
#pragma datamodel(pop) // Restore previous setting of datamodel
You can also specify data models using the __ptr64 and __ptr128 pointer modifiers. These modifers
override the DTAMDL compiler option, and the #pragma datamodel setting for a specific pointer
declaration.
The __ptr64 modifier should only be used if the TERASPACE(*YES) compiler option is also specified. The
__ptr128 modifier can be used at any time.
The following example shows the declarations of a process local pointer and a tagged space pointer:
char * __ptr64 p; // an 8-byte, process local pointer
char * __ptr128 t; // a 16-byte, tagged space pointer
For more information, see Using Teraspace in IBM Rational Developer for i: ILE C/C++ Programmer's Guide,
and Teraspace and single-level store in ILE Concepts.
define syntax
Description
The #pragma define directive forces the definition of a template class without actually defining an object
of the class. The pragma can appear anywhere that a declaration is allowed. It is used when organizing
your program for the efficient or automatic generation of template functions.
descriptor syntax
od_specifiers:
""
void
*
▼ , ""
void
*
Description
An operational descriptor is an optional piece of information that is associated with a function argument.
This information is used to describe an argument's attributes, for example, its data type and length. The
#pragma descriptor directive is used to identify functions whose arguments have operational descriptors.
Operational descriptors are useful when passing arguments to functions that are written in other
languages that may have a different definition of the data types of the arguments. For example, C defines
a string as a contiguous sequence of characters ended by and including the first null character. In another
language, a string may be defined as consisting of a length specifier and a character sequence. When
passing a string from a C function to a function written in another language, an operational descriptor
can be provided with the argument to allow the called function to determine the length and type of the
string being passed.
The ILE C/C++ compiler generates operational descriptors for arguments that are passed to a function
specified in a #pragma descriptor directive. The generated descriptor contains the descriptor type, data
type, and length for each argument that is identified as requiring an operational descriptor. The
information in an operational descriptor can be retrieved by the called function using the ILE APIs
CEEGSI and CEEDOD. For more information about CL commands, see the CL and APIs section in the
Programming category at the i5/OS Information Center Web site:
http://www.ibm.com/systems/i/infocenter
For the operational descriptor to determine the correct string length when passed through a function, the
string has to be initialized.
Note: A character string in ILE C/C++ is defined by using any one of the following ways:
v char string_name[n]
v char * string_name
v A string literal
Parameters
function_name The name of the function whose arguments require operational descriptors.
od_specifiers A list of symbols, that consists of "", void, or *, separated by commas, that specify which
Notes on Usage
Do not specify #pragma descriptor together with #pragma argopt for the same declaration. The compiler
supports using only one or the other of these pragmas at a time.
The compiler issues a warning and ignores the #pragma descriptor directive if any of the following
conditions occur:
v The identifier specified in the pragma directive is not a function.
v The function is already specified in another pragma descriptor.
v The function is declared as static.
v The function has already been specified in a #pragma linkage directive.
v The function specified is a user entry procedure, for example, main().
v The function is not prototyped before its #pragma descriptor directive.
v A call to the function occurs before its #pragma descriptor directive.
disable_handler syntax
►► # pragma disable_handler ►◄
Description
Disables the handler most recently enabled by either the exception_handler or cancel_handler pragma.
This directive is only needed when a handler has to be explicitly disabled before the end of a function.
This is done since all enabled handlers are implicitly disabled at the end of the function in which they are
enabled.
Notes on Usage
This pragma can only occur at a C language statement boundary and inside a function definition. The
compiler issues an error message if the #pragma disable_handler is specified when no handler is
currently enabled.
disjoint syntax
Description
This directive informs the compiler that none of the identifiers listed shares the same physical storage,
which provides more opportunity for optimizations. If any identifiers actually share physical storage, the
pragma may cause the program to give incorrect results.
An identifier in the directive must be visible at the point in the program where the pragma appears. The
identifiers in the disjoint name list cannot refer to any of the following items:
v a member of a structure, or union
v a structure, union, or enumeration tag
v an enumeration constant
v a typedef name
v a label
Example
int a, b, *ptr_a, *ptr_b;
#pragma disjoint(*ptr_a, b) // *ptr_a never points to b
#pragma disjoint(*ptr_b, a) // *ptr_b never points to a
one_function()
{
b = 6;
*ptr_a = 7; // Assignment does not alter the value of b
another_function(b); // Argument "b" has the value 6
}
Because external pointer ptr_a does not share storage with and never points to the external variable b,
the assignment of 7 to the object that ptr_a points to will not change the value of b. Likewise, external
pointer ptr_b does not share storage with and never points to the external variable a. The compiler can
assume that the argument of another_function has the value 6 and will not reload the variable from
memory.
| do_not_instantiate syntax
| Description
| Prevents the specified template declaration from being instantiated. You can use this pragma to suppress
| the implicit instantiation of a template for which a definition is supplied.
| Parameters
| template_class_name
| The name of the template class that should not be instantiated.
| Notes on Usage
| If you are handling template instantiations manually (that is, compiler options TEMPLATE(*NONE) and
| TMPLREG(*NONE) are in effect), and the specified template instantiation exists in another compilation
| unit, using #pragma do_not_instantiate ensures that you do not get multiple symbol definitions during
| the link step.
| Examples
enum syntax
►► #pragma enum ( 1 ) ►◄
2
4
int
small
pop
system_default
user_default
| enum syntax
| ►► #pragma enum ( 1 ) ►◄
2
4
8
int
intlong
small
pop
system_default
user_default
|
Description
Specifies the number of bytes the compiler uses to represent enumerations. The pragma affects all
subsequent enum definitions until the end of the compilation unit or until another #pragma enum
directive is encountered. If more than one pragma is used, the most recently encountered pragma is in
effect. This pragma overrides the ENUM compiler option, described on page 118.
Parameters
| 1, 2, 4, 8
| Specifies that enumerations be stored in 1, 2, 4, or 8-byte containers. The sign of the container is
| determined by the range of values in the enumeration, but preference is given to signed when the
| range permits either. The pragma enum(8) directive is only available in C++.
int Causes enumerations to be stored in the ANSI C or C++ Standard representation of an
enumeration, which is 4-bytes signed. In C++ programs, the int container may become 4-bytes
unsigned if a value in the enumeration exceeds 231-1, as per the ANSI C++ Standard.
| intlong
| Specifies that enumerations occupy 8 bytes of storage if the range of values in the enumeration
| exceeds the limit for int. If the range of values in the enumeration does not exceed the limit for
| int, the enumeration will occupy 4 bytes of storage and is represented as though enum(int) was
| specified. The pragma enum(intlong) directive is only available in C++
small Causes subsequent enumerations to be placed into the smallest possible container, given the
values in the enumeration. The sign of the container is determined by the range of values in the
enumeration, but preference is given to unsigned when the range permits either.
pop Selects the enumeration size previously in effect, and discards the current setting.
The value ranges that can be accepted by the enum settings are shown below:
| Table 2. Value Ranges Accepted by the enum Settings
| Enum Options
|| Range of Element 8 intlong
||| Values small
1 2 4 int
|| (default)
(C++ only) (C++ only)
|| 0 .. 127
1 byte 1 byte 2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| unsigned signed signed signed signed
|| 0 .. 255
1 byte 1 byte 2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| unsigned unsigned signed signed signed
|| -128 .. 127
1 byte 1 byte 2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| signed signed signed signed signed
|| 0 .. 32767
2 bytes
ERROR
2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| unsigned signed signed signed
|| 0 .. 65535
2 bytes
ERROR
2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| unsigned unsigned signed signed
|| -32768 .. 32767
2 bytes
ERROR
2 bytes 4 bytes 8 bytes
4 bytes signed 4 bytes signed
| signed signed signed signed
|| 0 .. 2147483647
4 bytes
ERROR ERROR
4 bytes 8 bytes
4 bytes signed 4 bytes signed
| unsigned signed signed
| C++ 4 bytes
|| 0 .. 4294967295
4 bytes
ERROR ERROR
4 bytes 8 bytes unsigned
4 bytes unsigned
| unsigned unsigned signed
| C ERROR
|| -2147483648 .. 4 bytes
ERROR ERROR
4 bytes 8 bytes
4 bytes signed 4 bytes signed
| 2147483647 signed signed signed
|| 0 .. (263 -1)
8 bytes 8 bytes
|| unsigned
ERROR ERROR ERROR
signed
ERROR 8 bytes signed
| (C++ only)
|| 0.. 2 64
8 bytes 8 bytes
|| unsigned
ERROR ERROR ERROR
unsigned
ERROR 8 bytes unsigned
| (C++ only)
|| -2 63
.. (2 63
-1)
8 bytes 8 bytes
|| signed
ERROR ERROR ERROR
signed
ERROR 8 bytes signed
| (C++ only)
|
Examples
The examples below show various uses of the #pragma enum and compiler options:
1. You cannot change the storage allocation of an enum by using #pragma enum within the declaration
of an enum. The following code segment generates a warning and the second occurrence of the enum
option is ignored:
#pragma enum ( small )
enum e_tag { a, b,
#pragma enum ( int ) /* error: cannot be within a declaration */
c
} e_var;
The enumerations test_enum and first_order both occupy 4 bytes of storage and are of type int. The
variable u_char_e_var defined in small_enum.h occupies 1 byte of storage and is represented by an
unsigned char data type.
4. If the code fragment below is compiled with the ENUM = *SMALL option:
enum e_tag {a, b, c} e_var;
the range of enum constants is 0 through 2. This range falls within all of the ranges described in the
table above. Based on priority, the compiler uses predefined type unsigned char.
5. If the code fragment below is compiled with the ENUM = *SMALL option:
enum e_tag {a=-129, b, c} e_var;
all enum variables within your source file will occupy the minimum amount of storage, unless
#pragma enum directives override the ENUM option.
7. If you compile a file yourfile.c that contains the following lines:
enum testing {ONE, TWO, THREE};
enum testing test_enum;
the enum variables test_enum and first_order will be minimum-sized (that is, each will only occupy 1
byte of storage). The other enum variable, listening_type, will be of type int and occupy 4 bytes of
storage.
exception_handler syntax
► ) ►◄
, ctl_action
, msgid_list
Description
Enables a user-defined ILE exception handler at the point in the code where the #pragma
exception_handler is located.
Any exception handlers enabled by #pragma exception_handler that are not disabled using #pragma
disable_handler are implicitly disabled at the end of the function in which they are enabled.
Parameters
function Specifies the name of the function to be used as a user-defined ILE exception handler.
label Specifies the name of the label to be used as a user-defined ILE exception handler. The
label must be defined within the function where the #pragma exception_handler is
enabled. When the handler gets control, the exception is implicitly handled and control
resumes at the label defined by the handler in the invocation containing the #pragma
exception_handler directive. The call stack is canceled from the newest call to, but not
including, the call containing the #pragma exception_handler directive. The label can be
placed anywhere in the statement part of the function definition, regardless of the
position of the #pragma exception_handler.
com_area Used for the communications area. If no com_area should be specified, zero is used as the
second parameter of the directive. If a com_area is specified on the directive, it must be a
variable of one of the following data types: integral, float, double, struct, union, array,
enum, pointer, or packed decimal. The com_area should be declared with the volatile
qualifier. It cannot be a member of a structure or a union.
class1, class2 Specifies the first four bytes and the last four bytes of the exception mask. The <except.h>
header file describes the values that you can use for the class masks. It also contains
macro definitions for these values. class1 and class2 must evaluate to integer constant
expressions after any necessary macro expansions. You can monitor for the valid class2
values of:
v _C2_MH_ESCAPE
v _C2_MH_STATUS
v _C2_MH_NOTIFY, and
v _C2_FUNCTION_CHECK.
ctl_action Specifies an integer constant to indicate what action should take place for this exception
handler. If handler is a function, the default value is _CTLA_INVOKE. If handler is a
label, the default value is _CTLA_HANDLE. This parameter is optional.
The following are valid exception control actions that are defined in the <except.h>
header file:
msgid_list Specifies an optional string literal that contains the list of message identifiers. The
exception handler will take effect only when an exception occurs whose identifiers match
one of the identifiers on the list of message identifiers. The list is a series of 7-character
message identifiers where the first three characters are the message prefix and the last
four are the message number. Each message identifier is separated by one or more spaces
or commas. This parameter is optional, but if it is specified, ctl_action must also be
specified.
For the exception handler to get control, the selection criteria for class1 and class2 must be
satisfied. If the msgid_list is specified, the exception must also match at least one of the
message identifiers in the list, based on the following criteria:
v The message identifier matches the exception exactly.
v A message identifier, whose two rightmost characters are 00, will match any exception
identifier that has the same five leftmost characters. For example, a message identifier
of CPF5100 will match any exceptions whose message identifier begins with CPF51.
v A message identifier, whose four rightmost characters are 0000, will match any
exception identifier that has the same prefix. For example, a message identifier of
CPF0000 will match any exception whose message identifier has the prefix CPF
(CPF0000 to CPF9999).
v If msgid_list is specified, but the exception that is generated is not one specified in the
list, the exception handler will not get control.
Notes on Usage
The macro _C1_ALL, defined in the <except.h> header file, can be used as the equivalent of all the valid
class1 exception masks. The macro _C2_ALL, defined in the <except.h> header file, can be used as the
equivalent of all four of the valid class2 exception masks.
will set up an exception monitor for three of the four class2 exception classes that can be monitored.
| hashome syntax
Description
Informs the compiler that the specified class has a home module that will be specified by #pragma
ishome. This class's virtual function table, along with certain inline functions, will not be generated as
static. Instead, they will be referenced as externals in the compilation unit of the class in which #pragma
ishome was specified.
Parameters
className Specifies the name of a class that requires the above mentioned external referencing.
className must be a class and it must be defined.
AllInlines specifies that all inline functions from within className should be referenced as being
external. This argument is case insensitive.
A warning will be produced if there is a #pragma ishome without a matching #pragma hashome.
implementation syntax
Description
The #pragma implementation directive tells the compiler the name of the file containing the
function-template definitions that correspond to the template declarations in the include file which
contains the pragma. This pragma can appear anywhere that a declaration is allowed. It is used when
organizing your program for the efficient or automatic generation of template functions.
info syntax
▼ nogroup ,
group
Description
This pragma can be used to control which diagnostic messages are produced by the compiler.
Parameters
all Generates all diagnostic messages while this pragma is in effect.
none Turns off all diagnostic messages while this pragma is in effect.
restore Restores the previous setting of pragma info.
nogroup Suppresses all diagnostic messages associated with a specified diagnostic group. To turn
off a specific group of messages, prepend the group name with "no". For example, nogen
will suppress CHECKOUT messages. Valid group names are listed below.
group Generates all diagnostic messages associated with the specified diagnostic group. Valid
group names are:
lan Display information about the effects of the language level
gnr Generate messages if the compiler creates temporary variables
cls Display information about class use
eff Warn about statements with no effect
cnd Warn about possible redundancies or problems in conditional expressions
rea Warn about unreachable statements
par List the function parameters that are not used
por List the non-portable usage of the C/C++ language
trd Warn about the possible truncation or loss of data
use Check for unused auto or static variables
gen List the general CHECKOUT messages
inline syntax
Description
| The #pragma inline directive specifies that function_name is to be inlined. The pragma can appear
| anywhere in the source, but must be at file scope. The pragma has no effect if the INLINE(*ON) compiler
| option parameter is not specified. If #pragma inline is specified for a function, the inliner will force the
| function specified to be inlined on every call. The function will be inlined in both selective (*NOAUTO)
| and automatic (*AUTO) INLINE mode.
Inlining replaces function calls with the actual code of the function. It reduces function call overhead, and
exposes more code to the optimizer, allowing more opportunities for optimization.
Notes on Usage
v Inlining takes place only if compiler optimization is set to level 30 or higher.
v Directly recursive functions will not be inlined. Indirectly recursive functions will be inlined until direct
recursion is encountered.
v Functions calls with variable argument lists will not be inlined if arguments are encountered in the
variable portion of the argument list.
v If a function is called through a function pointer, then inlining will not occur.
v The pragma inline directive will be ignored if function_name is not defined in the same compilation
unit that contains the pragma.
v A function's definition will be discarded if all of the following are true:
– The function is static.
– The function has not had its address taken.
– The function has been inlined everywhere it is called.
This action can decrease the size of the module and program object where the function is used.
See the "Function Call Performance" in the IBM Rational Developer for i: ILE C/C++ Programmer's Guide for
more information about function inlining.
ishome syntax
Description
Informs the compiler that the specified class's home module is the current compilation unit. The home
module is where items, such as the virtual function table, are stored. If an item is referenced from outside
of the compilation unit, it will not be generated outside its home. The advantage of this is the
minimization of code.
Parameters
className Specifies the literal name of the class whose home will be the current compilation unit.
A warning will be produced if there is a #pragma ishome without a matching #pragma hashome.
isolated_call syntax
Description
Lists a function that does not have or rely on side effects, other than those side effects implied by its
parameters.
Parameters
function Specifies a primary expression that can be an identifier, operator function, conversion
function, or qualified name. An identifier must be of type function or a typedef of
function. If the name refers to an overloaded function, all variants of that function are
marked as isolated calls.
Notes on Usage
The pragma informs the compiler that the function listed does not have or rely on side effects, other than
those side effects implied by its parameters. Functions are considered to have or rely on side effects if
they:
v Access a volatile object
v Modify an external object
v Modify a static object
v Modify a file
v Access a file that is modified by another process or thread
v Allocate a dynamic object, unless it is released before returning
v Release a dynamic object, unless it was allocated during the same invocation
v Change system state, such as rounding mode or exception handling
v Call a function that does any of the previous
Essentially, any change in the state of the run-time environment is considered a side effect. Modifying
function arguments passed by pointer or by reference is the only side effect that is allowed. Functions
with other side effects can give incorrect results when listed in #pragma isolated_call directives.
Marking a function as isolated_call indicates to the optimizer that external and static variables cannot be
changed by the called function and that pessimistic references to storage can be deleted from the calling
function where appropriate. Instructions can be reordered with more freedom, resulting in fewer pipeline
delays, and faster execution in the processor. Multiple calls to the same function with identical
parameters can be combined, calls can be deleted if their results are not needed, and the order of calls
can be changed.
The function specified is permitted to examine non-volatile external objects and return a result that
depends on the non-volatile state of the run-time environment. The function can also modify the storage
pointed to by any pointer arguments passed to the function, that is, calls by reference. Do not specify a
function that calls itself or relies on local static storage. Listing such functions in the #pragma
isolated_call directive can give unpredictable results.
linkage syntax
Description
Identifies a given function or function typedef as being an external program subject to i5/OS parameter
passing conventions.
This pragma allows calls only to external programs. For information about making calls to bound
procedures, see #pragma “argument” on page 13.
Parameter
program_name Specifies the name of an external program. The external name must be specified in
uppercase characters and be no longer than 10 characters in length, unless the #pragma
map directive is specified to meet i5/OS program naming conventions. However, if the
name specified in #pragma map is too long, it will be truncated to 255 characters during
#pragma linkage processing.
typedef_name Specifies a typedef affected by this pragma.
OS Specifies that the external program is called using i5/OS calling conventions.
nowiden If specified, arguments are not widened before they are copied and passed.
Notes on Usage
This pragma lets an IBM i program call an external program. The external program can be written in any
language.
The pragma can be applied to functions, function types, and function pointer types. If it is applied to a
function typedef, the effect of the pragma also applies to all functions and new typedefs declared using
that original typedef.
This directive can appear either before or after the program name (or type) is declared. However, the
program cannot have been called, nor a type been used in a declaration, before the pragma directive.
The function or function pointer can only return either an int or a void.
Arguments on the call are passed according to the following i5/OS argument-passing conventions:
v Non-address arguments are copied to temporary locations, widened (unless nowiden has been
specified) and the address of the copy is passed to the called program.
v Address arguments are passed directly to the called program.
The compiler issues a warning message and ignores the #pragma linkage directive if:
v The program is declared with a return type other than int or void.
v The function contains more than 256 parameters.
v Another pragma linkage directive has already been specified for the function or function type.
v The function has been defined in the current compilation unit.
map syntax
| map syntax
Description
| Parameters
| name1 The name used in the source code. For C, name1 can represent a data object or function
| with external linkage. For C++, name1 can represent a data object, a non-overloaded or
| overloaded function, or overloaded operator, with external linkage. If the name to be
| mapped is not in the global namespace, it must be fully qualified.
| name1 should be declared in the same compilation unit in which it is referenced, but
| should not be defined in any other compilation unit. name1 must not be used in another
| #pragma map directive anywhere in the program.
| arg_list The list of arguments for the overloaded function or operator function designated by
| name1. If name1 designates an overloaded function, the function must be parenthesized
| and must include its argument list if it exists. If name1 designates a non-overloaded
| function, only name1 is required, and the parentheses and argument list are optional.
| name2 The name that appears in the object code. If name2 exceeds 65535 bytes in length, a
| message is issued and the pragma is ignored.
| name2 can be declared or defined in the same compilation unit in which name1 is
| referenced. name2 must not be the same as that used in another #pragma map directive in
| the same compilation unit.
| Notes on Usage
| In order for a function to be actually mapped, the map target function (name2) must have a definition
| available at link time.
| If name2 specifies a function name that uses C++ linkage, then name2 must be specified using its mangled
| name. For example,
| int foo(int, int);
| #pragma map(foo, "bar__FiT1")
|
| int main( )
| {
| return foo(4,5);
| }
|
mapinc syntax
*LIBL/
► " file_name ( *ALL ) " , "options" , ►
*CURLIB/
▼ format_name
library_name/
d z
► " " ) ►◄
_P 1BYTE_CHAR , "union_type_name"
p , "prefix_name"
Description
Indicates that data description specifications (DDS) are to be included in a module. The directive
identifies the file and DDS record formats, and provides information about the fields to be included. This
pragma, along with its associated include directive, causes the compiler to automatically generate
typedefs from the record formats that are specified in the external file descriptions.
Parameters
include_name This is the name that you refer to on the #include directive in the source program.
library_name This is the name of the library that contains the externally described file
file_name This is the name of the externally described file.
format_name This is a required parameter which indicates the DDS record format that is to be included
in your program. You can include more than one record format (format1 format2), or all
the formats in a file (*ALL).
options The possible options are:
input Fields declared as either INPUT or BOTH in the DDS are included in the
typedef structure. Response indicators are included in the input structure
when the keyword INDARA is not specified in the external file
description (DDS source) for device files.
output Fields declared as either OUTPUT or BOTH in DDS are included in the
typedef structure. Option indicators are included in the output structure
when the keyword INDARA is not specified in the external file
description (DDS source) for device files.
both Fields declared as INPUT, OUTPUT, or BOTH in DDS are included in the
typedef structure. Option and response indicators are included in both
structures when the keyword INDARA is not specified in the external file
description (DDS source) for device files.
key Fields that are declared as keys in the external file description are
included. This option is only valid for database files and DDM files.
Notes on Usage
See Using Externally Described Files in a Program in IBM Rational Developer for i: ILE C/C++ Programmer's
Guide for more information about using the #pragma mapinc directive with externally described files.
margins syntax
Description
Specifies the left margin to be used as the first column, and the right margin to be used as the last
column, when scanning the records of the source member where the #pragma directive occurs.
The margin setting applies only to the source member in which it is located and has no effect on any
source members named on include directives in the member.
Parameters
left margin Must be a number greater than zero but less than 32 754. The left margin should be less
than the right margin.
right margin Must be a number greater than zero but less than 32 754, or an asterisk (*). The right
margin should be greater than the left margin. The compiler scans between the left margin
and the right margin. The compiler scans from the left margin specified to the end of the
input record, if an asterisk is specified as the value of right margin.
Notes on Usage
The #pragma margins directive takes effect on the line following the directive and remains in effect until
another #pragma margins or nomargins directive is encountered or the end of the source member is
reached.
The #pragma margins and #pragma sequence directives can be used together. If these two #pragma
directives reserve the same columns, the #pragma sequence directive has priority, and the columns are
reserved for sequence numbers.
For example, if the #pragma margins directive specifies margins of 1 and 20, and the #pragma sequence
directive specifies columns 15 to 25 for sequence numbers, the margins in effect are 1 and 14, and the
columns reserved for sequence numbers are 15 to 25.
If the margins specified are not in the supported range or the margins contain non-numeric values, a
warning message is issued during compilation and the directive is ignored.
| namemangling syntax
| ansi
►► # pragma namemangling ( v6 ) ►◄
v5 , num_chars
v3
compat
pop
|
Description
| Chooses the name mangling scheme for external symbol names generated from C++ source code. The
| option and pragma are provided to ensure binary compatibility with link modules created with previous
| versions of the compiler. If you do not need to ensure backwards compatibility, it is recommended that
| you do not change the default setting of this option.
Parameters
| ansi The name mangling scheme fully supports the most recent language features of Standard
| C++, including function template overloading. ansi is the default.
| v6 The name mangling scheme is the same as used in the V5R3M0, V5R4M0, and V6R1M0
| versions of the compiler.
| v5 The name mangling scheme is the same as used in the V5R1M0 and V5R2M0 versions of
| the compiler.
| v3 The name mangling scheme is the same as in versions of the compiler before V5R1M0.
| compat This option is the same as v3, described previously.
| num_chars Specifies the maximum number of allowable characters in the mangled names. If you do
| not specify this suboption, the default maximum is 64000 characters for all settings except
| v3 and compat, for which the default maximum is 255 characters.
| pop Discards the current pragma setting and reverts to the setting specified by the previous
| pragma directive. If no previous pragma was specified, the default setting of ansi is used.
Note on Usage
| The #pragma namemangling directive is not supported if the RTBND(*LLP64) compile option is used.
| namemanglingrule syntax
| on
►► # pragma namemanglingrule ( fnparmtype, off ) ►◄
pop
on
fnparmscmp, off
pop
|
| Description
| Provides fine-grained control over the name mangling scheme in effect for selected portions of source
| code, specifically with respect to the mangling of cv-qualifiers in function parameters.
| The #pragma namemanglingrule directive allows you to control whether top-level cv-qualifiers are
| mangled in function parameters or whether intermediate-level cv-qualifiers are to be considered when the
| compiler compares repeated function parameters for equivalence.
| Defaults
| Parameters
| fnparmtype, on
| Top-level cv-qualifiers are not encoded in the mangled name of a function parameter.
| Also, top-level cv-qualifiers are ignored when repeated function parameters are compared
| for equivalence; function parameters that differ only by the use of a top-level cv-qualifier
| are considered equivalent and are mangled according to the compressed encoding
| scheme. This setting is compatible with ILE C++ V5R3M0 and later releases.
| fnparmtype, off
| Top-level cv-qualifiers are encoded in the mangled name of a function parameter. Also,
| repeated function parameters that differ by the use of cv-qualifiers are not considered
| equivalent and are mangled as separate parameters. This setting is compatible with ILE
| C++ V5R2M0 and earlier releases.
| fnparmtype, pop
| Reverts to the previous fnparmtype setting in effect. If no previous settings are in effect,
| the default fnparmtype setting is used.
| fnparmscmp, on
| Intermediate-level cv-qualifiers are considered when repeated function parameters are
| compared for equivalence; repeated function parameters that differ by the use of
| intermediate-level cv-qualifiers are mangled as separate parameters. This setting is
| compatible with ILE C++ V7R1M0 and later releases.
| fnparmscmp, off
| Intermediate-level cv-qualifiers are ignored when repeated function parameters are
| compared for equivalence; function parameters that differ only by the use of an
| Notes on Usage
| 1. #pragma namemanglingrule is allowed in global, class, and function scopes. It has no effect on a
| block scope function declaration with external linkage.
| 2. Different pragma settings can be specified in front of function declarations and definitions. If #pragma
| namemanglingrule settings in subsequent declarations and definitions conflict, the compiler ignores
| those settings and issues a warning message.
| 3. The #pragma namemanglingrule directive is not supported if the RTBND(*LLP64) compile option is
| used.
noargv0 syntax
►► # pragma noargv0 ►◄
Description
Specifies that the source program does not make use of argv[0]. This pragma can improve performance of
applications that have a large number of small C programs, or a small program that is called many times.
Notes on Usage
The #pragma noargv0 must appear in the compilation unit where the main() function is defined,
otherwise it is ignored.
argv[0] will be NULL when the noargv0 pragma directive is in effect. Other arguments in the argument
vector will not be affected by this directive. If the #pragma noargv0 directive is not specified, argv[0] will
contain the name of the program that is currently running.
noinline syntax
Description
| Specifies that a function will not be inlined. The settings on the INLINE compiler option will be ignored
| for this function_name.
Notes on Usage
The first pragma specified will be the one that is used. If #pragma inline is specified for a function after
#pragma noinline has been specified for it, a warning will be issued to indicate that #pragma noinline has
already been specified for that function.
| The #pragma noinline directive can only occur at file scope. The pragma will be ignored, and a warning
| is issued if it is not found at file scope.
nomargins syntax
►► # pragma nomargins ►◄
Description
Notes on Usage
The #pragma nomargins directive takes effect on the line following the directive and remains in effect
until a #pragma margins directive is encountered or the end of the source member is reached.
nosequence syntax
►► # pragma nosequence ►◄
Description
Specifies that the input record does not contain sequence numbers.
Notes on Usage
The #pragma nosequence directive takes effect on the line following the directive and remains in effect
until a #pragma sequence directive is encountered or the end of the source member is reached.
nosigtrunc syntax
►► # pragma nosigtrunc ►◄
Description
Specifies that no exception is generated at run time when overflow occurs with packed decimals in
arithmetic operations, assignments, casting, initialization, or function calls. This directive suppresses the
signal that is raised in packed decimal overflow. The #pragma nosigtrunc directive can only occur at
filescope. A warning message will be issued if the #pragma nosigtrunc directive is encountered at
function, block or function prototype scope, and the directive will be ignored.
Notes on Usage
This #pragma directive has file scope and must be placed outside a function definition; otherwise it is
ignored. A warning message may still be issued during compilation for some packed decimal operations
if overflow is likely to occur. See IBM Rational Developer for i: ILE C/C++ Programmer's Guide for more
information about packed decimal errors.
pack syntax
►► # pragma pack ( ) ►◄
1
2
4
8
16
default
system
pop
reset
Description
The #pragma pack directive specifies the alignment rules to use for the members of the structure, union,
or (C++ only) class that follows it. In C++, packing is performed on declarations or types. This is different
from C, where packing is also performed on definitions.
| You can also use the PACKSTRUCT option with the compiler commands to cause packing to be
| performed along specified boundaries. See “PACKSTRUCT” on page 117 for more information.
Parameters
1, 2, 4, 8, 16 Structures and unions are packed along the specified byte boundaries.
default Selects the alignment rules specified by compiler option PACKSTRUCT.
system Selects the default IBM i alignment rules.
pop, reset Selects the alignment rules previously in effect, and discards the current rules. This is the
same as specifying #pragma pack ( ).
In the examples that follow, the words struct or union can be used in place of class.
The #pragma pack settings are stack based. All pack values are pushed onto a stack as the user's source
code is parsed. The value on the top of that stack is the current packing value. When a #pragma pack
(reset), #pragma pack(pop), or #pragma pack() directive is given, the top of the stack is popped and the
next element in the stack becomes the new packing value. If the stack is empty, the value of the
PACKSTRUCT compiler option, if specified, is used. If not specified, the default setting of NATURAL
alignment is used.
The setting of the PACKSTRUCT compiler option is overridden by the #pragma pack directive, but
always remains on the bottom of the stack. The keyword _Packed has the highest precedence with
respect to packing options, and cannot be overridden by the #pragma pack directive or the
PACKSTRUCT compiler option.
By default, all members use their natural alignment. Members cannot be aligned on values greater than
their natural alignment. Char types can only be aligned along 1-byte boundaries. Short types can only be
aligned along 1 or 2-byte boundaries, and int types can be aligned along on 1, 2, or 4-byte boundaries.
All 16-byte pointers will be aligned on a 16-byte boundary. _Packed, PACKSTRUCT, and #pragma pack
cannot alter this. 8-byte teraspace pointers may have any alignment, although 8-byte alignment is
preferred.
__align syntax
struct_specifier syntax
You can also use the __align specifier to explicitly specify alignment when declaring or defining data
items, as shown in some of the examples that follow.
| _Packed Specifier: _Packed can be associated with struct, union, and in C++, class definitions. In C++,
| _Packed must be specified on a typedef. It has the same effect as #pragma pack(1). The following code
| shows examples of valid and invalid usages of _Packed. In these examples, the keywords struct, union,
| and class can be used interchangeably.
| typedef _Packed class SomeClass { /* ... */ } MyClass; // OK
| typedef _Packed union AnotherClass {} PUnion; // OK
| typedef _Packed struct {} PAnonStruct; // Invalid, struct must be named
| Class Stack { /* ... */ };
| _Packed Stack someObject; // Invalid, specifier _Packed must be
| __alignof Operator:
unary-expression:
__alignof unary-expression
__alignof ( type-name )
The __alignof operator returns the alignment of its operand, which may be an expression or the
parenthesized name of a type. The alignment of the operand is determined according to i5/OS™
alignment rules. However, it should not be applied to an expression that has function type or an
incomplete type, to the parenthesized name of such a type, or to an expression that designates a bit-field
member. The type of the result of this operator is size_t.
Examples
In the examples that follow, the words union and class might be used in place of the word struct.
1. Popping the #pragma pack Stack
Specifying #pragma pack (pop), #pragma pack (reset), or #pragma pack() pops the stack by one and
resets the alignment requirements to the state that was active before the previous #pragma pack was
seen. For example,
// Default alignment requirements used
.
.
#pragma pack (4)
struct A { };
#pragma pack (2)
struct B { };
struct C { };
#pragma pack (reset)
struct D { };
#pragma pack ()
struct E { };
#pragma pack (pop)
struct F { };
When struct A is mapped, its members are aligned according to #pragma pack(4). When struct B
and struct C are mapped, their members are aligned according to pragma pack(2).
The #pragma pack (reset) pops the alignment requirements specified by #pragma pack(2) and resets
the alignment requirements as specified by #pragma pack(4).
When struct D is mapped, its members are aligned according to pragma pack(4). The #pragma pack
() pops the alignment requirements specified by #pragma pack(4) and resets the alignment
requirements to the default values used at the beginning of the file.
When struct E is mapped, its members are aligned as specified by the default alignment
requirements (specified on the command line) active at the beginning of the file.
The #pragma pack (pop) has the same affect as the previous #pragma pack directives in that it pops
the top value from the pack stack. However, the default pack value, as specified in the PACKSTRUCT
compiler option, cannot be removed from the pack stack. That default value is used to align struct F.
2. __align & #pragma pack
__align(16) struct S {int i;}; /* sizeof(struct S) == 16 */
struct S1 {struct S s; int a;}; /* sizeof(struct S1) == 32 */
#pragma pack(2)
struct S2 {struct S s; int a;} s2; /* sizeof(struct S2) == 32 */
/* offsetof(S2, s1) == 0 */
/* offsetof(S2, a) == 16 */
3. #pragma pack
#pragma pack(8)
struct S2 { /* sizeof(struct S2) == 12 */
char a; /* offsetof(S2, a) == 0 */
int b; /* offsetof(S2, b) == 4 */
char c; /* offsetof(S2, c) == 8 */
short d; /* offsetof(S2, d) == 10 */
}S2; /* alignof(S2) == 4 */
4. PACKSTRUCT Compiler Option
If the following is compiled with PACK STRUCTURE set to 2:
struct S1 { /* sizeof(struct S1) == 10 */
char a; /* offsetof(S1, a) == 0 */
int b; /* offsetof(S1, b) == 2 */
char c; /* offsetof(S1, c) == 6 */
short d; /* offsetof(S1, d) == 8 */
}S1; /* alignof(S1) == 2 */
5. #pragma pack
If the following is compiled with PACK STRUCTURE set to 4:
#pragma pack(1)
struct A { // this structure is packed along 1-byte boundaries
char a1;
int a2;
}
#pragma pack(2)
struct B { // this class is packed along 2-byte boundaries
int b1;
float b2;
float b3;
};
struct B {
char a;
long b;
} varb;
int var;
#pragma pack(1)
struct B {
long a;
long b;
};
struct C {
struct {
short a;
int b;
} varb;
} var;
page syntax
►► # pragma page ( ) ►◄
n
Description
Skips n pages of the generated source listing. If n is not specified, the next page is started.
pagesize syntax
►► # pragma pagesize ( ) ►◄
n
Description
Sets the number of lines per page to n for the generated source listing. The pagesize pragma may not
affect the option listing page (sometimes called the Prolog).
pointer syntax
Description
Parameters
pointer_type which can be one of:
SPCPTR Space pointer
OPENPTR Open pointer
SYSPTR System pointer
INVPTR Invocation pointer
LBLPTR Label code pointer
SUSPENDPTR
Suspend pointer
Notes on Usage
The compiler issues a warning and ignores the #pragma pointer directive if any of the following errors
occur:
v The pointer type that is named in the directive is not one of SPCPTR, SYSPTR, INVPTR, LBLPTR,
SUSPENDPTR, or OPENPTR.
v The typedef named is not declared before the #pragma pointer directive.
v The identifier that is named as the first parameter of the directive is not a typedef.
v The typedef named is not a typedef of a void pointer.
v The typedef named is used in a declaration before the #pragma pointer directive.
See IBM Rational Developer for i: ILE C/C++ Programmer's Guide for more information about using IBM i
pointers.
priority syntax
►► # pragma priority ( n ) ►◄
Description
The #pragma priority directive specifies the order in which static objects are to be initialized at run time.
The value n is an integer literal in the range of INT_MIN to INT_MAX. The default value is 0. A
negative value indicates a higher priority; a positive value indicates a lower priority.
The first 1024 priorities (INT_MIN to INT_MIN + 1023) are reserved for use by the compiler and its
libraries. The #pragma priority can appear anywhere in the source file many times. However, the priority
of each pragma must be greater than the previous pragma's priority. This is necessary to ensure that the
run-time static initialization occurs in the declaration order.
Example
//File one called First.C
In this example, the execution sequence of the run-time static initialization is:
1. Static initialization with priority 1000 from file First.C
2. Static initialization with priority 2000 from file Second.C
3. Static initialization with priority 3000 from file First.C
sequence syntax
Description
Specifies the columns of the input record that are to contain sequence numbers. The column setting
applies only to the source setting in which it is located and has no effect on any source members named
on include directives in the member.
Parameters
left column Must be greater than zero but less than 32 754. The left column should be less than the
right column.
right column Must be greater than zero but less than 32 754. The right column should be greater than or
equal to the left column. An asterisk (*) that is specified as the right column value indicates
that sequence numbers are contained between left column and the end of the input record.
Notes on Usage
The #pragma sequence directive takes effect on the line following the directive. It remains in effect until
another #pragma sequence or #pragma nosequence directive is encountered or the end of the source
member is reached.
The #pragma margins and #pragma sequence directives can be used together. If these two #pragma
directives reserve the same columns, the #pragma sequence directive has priority, and the columns are
reserved for sequence numbers.
For example, if the #pragma margins directive specifies margins of 1 and 20 and the #pragma sequence
directive specifies columns 15 to 25 for sequence numbers, the margins in effect are 1 and 14, and the
columns reserved for sequence numbers are 15 to 25.
If the margins specified are not in the supported range or the margins contain non-numeric values, a
warning message is issued during compilation and the directive is ignored.
strings syntax
Description
Specifies that the compiler may place strings into read-only memory or must place strings into writeable
memory. Strings are writeable by default. This pragma must appear before any C or C++ code in a file.
weak syntax
Description
Parameters
identifier Specifies the name of an identifier considered to be a weak global symbol.
identifier2 If identifer2 is specified, then identifier is considered to be a weak global symbol whose
value is the same as identifier2. For this pragma to have effect, identifier2 must be defined
in the same compilation unit.
This pragma can appear anywhere in a program, and identifies a specified identifier as being a weak
global symbol. Identifier should not be defined, but it may be declared. If it is declared, and identifier2 is
specified, identifier must be of a type compatible to that of identifier2.
Example.
#pragma weak func1 = func2
This table describes the CL commands that are used with the IBM i compiler.
Table 3. Control Language Commands
Action Command Description
Create C Module CRTCMOD Creates a module object (*MODULE)
based on the source you provide.
Create C++ Module CRTCPPMOD
Create Bound C Program CRTBNDC Creates a program object (*PGM)
based on the source you provide.
Create Bound C++ Program CRTBNDCPP
CL commands and their parameters can be entered in either uppercase or lowercase. In this manual, they
are always shown in uppercase. For example:
CRTCPPMOD MODULE(ABC/HELLO) SRCSTMF(’/home/usr/hello.C’) OPTIMIZE(40)
ILE C/C++ language statements must be entered exactly as shown. For example, fopen, _Ropen, because
the ILE C/C++ compiler is case sensitive.
Variables appear in lowercase italic letters, for example, file-name, characters, and string. They represent
user-supplied names or values.
Language statements may contain punctuation marks, parentheses, arithmetic operators, or other such
symbols. You must enter them exactly as shown in the syntax diagram.
You can also invoke the compiler and its options through the Qshell command line environment. For
more information about Qshell command and option formats, see Chapter 4, “Using the ixlc Command to
Invoke the C/C++ Compiler,” on page 135
Syntax diagram
(1) *CURLIB/
►► CRTCMOD MODULE ( module-name ) ►
(2) library-name/
CRTCPPMOD
(1) *CURLIB/
CRTBNDC PGM ( program-name )
(2) library-name
CRTBNDCPP
► ►
SRCSTMF( ) *SRCMBRTXT
path-name TEXT( *BLANK )
' description '
► ►
*NONE
OUTPUT( *PRINT )
filename *BLANK *BLANK
TITLE title SUBTITLE subtitle
► ►
OPTION( OPTION Details ) CHECKOUT( CHECKOUT Details )
► ►
10 INLINE( INLINE Details )
OPTIMIZE( 20 )
30
40
► ►
(7) *NOKEEPILDTA *NONE
MODCRTOPT( ) DBGVIEW( *ALL )
*KEEPILDTA *STMT
*SOURCE
*LIST
► ►
*NONE *NONE
DBGENCKEY( ) DEFINE( ' name ' )
character-value ' name = value '
► ►
*EXTENDED *NOTYPEPTR
LANGLVL( *ANSI ) *NOALLPTRS
(2) *NOADDRTAKEN
*LEGACY *ANSI
ALIAS( *NOANSI )
*ADDRTAKEN
*ALLPTRS
*TYPEPTR
► ►
*LOCALE 0 *NOMAX 30
LOCALETYPE( *LOCALEUCS2 ) FLAG( 10 ) MSGLMT( 0 32767 0 )
(1) 20 10
*CLD 30 20
*LOCALEUTF
► ►
*YES (12) *USER
REPLACE( *NO ) USRPRF( *OWNER )
► ►
*LIBCRTAUT *CURRENT
AUT( *CHANGE ) TGTRLS( *PRV )
*USE release-level
*ALL
*EXCLUDE
authorization-list-name
► ►
*PEP
ENBPFRCOL( )
*ENTRYEXIT *ALLPRC
*FULL *NONLEAF
► ►
*SETFPCA *NOSTRDONLY *NOCOL
PFROPT( ) PRFDTA( *COL )
*NOSETFPCA *STRDONLY
► ►
*NO *SNGLVL
*NOTSIFC STGMDL( *TERASPACE )
TERASPACE( *YES ) *INHERIT
*TSIFC
► ►
*SMALL *NODEP
ENUM( 1 ) MAKEDEP( file-name )
2
4
*INT
► ►
*NONE
PPGENOPT( )
*DFT
*GENLINE
*RMVCOMMENT
*NORMVCOMMENT *NOGENLINE
*RMVCOMMENT
*GENLINE
*NOGENLINE *NORMVCOMMENT
► ►
(7) *CURLIB/ (7) *MODULE
PPSRCFILE( file-name ) PPSRCMBR( membername )
library-name/
► ►
(7) *NONE
PPSRCSTMF( ) INCDIR( directory-name )
pathname
*SRCSTMF
► ►
*NONE
CSOPT( )
' compiler-service-options-string '
► ►
*NONE *UNSIGNED
LICOPT( ) DFTCHAR( *SIGNED )
' Licensed-Internal-Code-Options-String '
► ►
(2) (7) (13) *NONE
TEMPLATE( TEMPLATE Details )
► ►
(2) (7) (13) *NONE (2) (13) *YES
TMPLREG( *DFT ) WEAKTMPL( *NO )
' path-name '
► ►◄
*HALFEVEN
DECFLTRND( *DOWN )
*UP
*HALFUP
*HALFDOWN
*FLOOR
*CEILING
OPTION Details:
(7) (2)
*NOFULL *GEN *NOINCDIRFIRST *LOGMSG *LONGLONG
► ►
*FULL (7) *INCDIRFIRST *NOLOGMSG (2)
*NOGEN *NOLONGLONG
(1)
*NOSHOWSKP *SHOWSRC *NOSHOWSYS *NOSHOWUSR *STDINC
► ►
(1) *NOSHOWSRC *SHOWSYS *SHOWUSR *NOSTDINC
*SHOWSKP
CHECKOUT Details:
*NOTRUNC *NOUNUSED
►
*TRUNC *UNUSED
INLINE Details:
|
*OFF
*ON
*AUTO
*NOAUTO INLINE Details (continued)
250
1-65535
*NOLIMIT 2000
1-65535
*NOLIMIT *NO
*YES
TEMPLATE Details:
*TEMPINC 1 *NO
directory-pathname
1 65535 *WARN
*ERROR
The term object is used throughout the descriptions and has one of two meanings:
v If you are using the CRTCMOD or CRTCPPMOD commands, object means module object.
v If you are using the CRTBNDC or CRTBNDCPP commands, object means program object.
MODULE
Valid only on the CRTCMOD and CRTCPPMOD commands. Specifies the module name and library for
the compiled ILE C or C++ module object.
MODULE Syntax:
*CURLIB/
MODULE( module-name )
library-name/
*CURLIB
This is the default library value. The object is stored in the current library. If a job does not have a
current library, QGPL is used.
library-name
Enter the name of the library where the object is to be stored.
module-name
Enter a name for the module object.
PGM
Valid only on the CRTBNDC and CRTBNDCPP commands. Specifies the program name and library for
the compiled ILE C or C++ program object.
PGM Syntax:
*CURLIB/
PGM( program-name )
library-name/
*CURLIB
This is the default library value. The object is stored in the current library. If a job does not have a
current library, QGPL is used.
library-name
Enter the name of the library where the object is to be stored.
program-name
Enter a name for the program object.
SRCFILE Syntax:
(3) (4)
QCPPSRC
(1) (2)
*LIBL/ QCSRC
SRCFILE( )
*CURLIB/ source-file-name
library-name/
Notes:
1 C Compiler only
2 C Compiler default setting
3 C++ Compiler only
4 C++ Compiler default setting
*LIBL
This is the default library value. The library list is searched to find the library where the source file is
located.
*CURLIB
The current library is searched for the source file. If a job does not have a current library, QGPL is
used.
library-name
Enter the name of the library that contains the source file.
QCSRC
The default name for the source physical file that contains the member with the ILE C source code
that you want to compile.
QCPPSRC
The default name for the source physical file that contains the member with the ILE C++ source code
that you want to compile.
source-file-name
Enter the name of the file that contains the member with the ILE C or C++ source code.
SRCMBR Syntax:
(2)
*PGM
(1)
*MODULE
SRCMBR( )
member-name
Notes:
1 Create Module command only
2 Create Bound Program command only
*MODULE
Valid only with the CRTCMOD or CRTCPPMOD commands. The module name that is supplied on the
MODULE parameter is used as the source member name. This is the default when a member name is
not specified.
*PGM
Valid only with the CRTBNDC or CRTBNDCPP commands. The program name that is supplied on the
PGM parameter is used as the source member name. This is the default when a member name is not
specified.
member-name
Enter the name of the member that contains the ILE C or C++ source code.
SRCSTMF Syntax:
SRCSTMF( )
path-name
The path name can be either absolutely or relatively qualified. An absolute path name starts with '/'; a
relative path name starts with a character other than '/'. If absolutely qualified, then the path name is
complete. If relatively qualified, the path name is completed by pre-pending the job's current working
directory to the path name.
Notes:
1. The SRCMBR and SRCFILE parameters cannot be specified with the SRCSTMF parameter.
2. If SRCSTMF is specified, then the following compiler options are ignored:
| v TEXT(*SRCMBRTXT)
| v OPTION(*STDINC)
| v OPTION(*SYSINCPATH)
3. The SRCSTMF parameter is not supported in a mixed-byte environment.
TEXT Syntax:
*SRCMBRTXT
TEXT( *BLANK )
' description '
*SRCMBRTXT
Default setting. The text description that is associated with the source file member is used for the
compiled object. If the source file is an inline file or a device file, this field is blank.
*BLANK
Specifies that no text appears.
description
Enter descriptive text no longer than 50 characters, and enclose it in single quotation marks. The
quotation marks are not part of the 50-character string. Quotation marks are supplied when the
CRTCMOD or CRTCPPMOD prompt screens are used.
OUTPUT Syntax:
*NONE
OUTPUT( *PRINT )
filename *BLANK *BLANK
TITLE title SUBTITLE subtitle
*NONE
Does not generate the compiler listing. When a listing is not required, use this default to improve
compile-time performance. When *NONE is specified, the following listing-related options are
ignored if they are specified on the OPTION keyword: *AGR, *EXPMAC, *FULL, *SECLVL,
*SHOWINC, *SHOWSKP, *SHWSRC, *SHOWSYS, *SHOWUSR, *SHWSRC, *STRUCREF, *XREF, or
*XREFREF.
*PRINT
Generate the compiler listing as a spool file.
The spool file name in WRKSPLF will have the same name as the object (program or module) being
created.
filename
The compiler listing is saved in the file name specified by this string.
The listing name must be in Integrated File System (IFS) format, for example /home/mylib/listing/
hello.lst. A data management file listing in library mylib should be specified as /QSYS.LIB/mylib.lib/
listing.file/hello.mbr. If the string does not begin with a "/", it will be considered a subdirectory of
the current directory or library. If the file does not exist, the file will be created.
Data authority *WX is required to create an IFS listing. Data authority *WX, object authority
*OBJEXIST and *OBJALTER are required to create a data management file listing via IFS.
TITLE
Specifies the title for the compiler listing. Possible TITLE values are:
*BLANK
No title is generated.
title
Specify a title string (maximum 98 characters) for the listing.
SUBTITLE
Specifies the subtitle for the compiler listing. Possible SUBTITLE values are:
*BLANK
No title is generated.
subtitle
Specify a subtitle string (maximum 98 characters) for the listing file.
OPTION Syntax:
OPTION Details:
(3) (2)
*NOFULL *GEN *NOINCDIRFIRST *LOGMSG *LONGLONG
► ►
*FULL (3) *INCDIRFIRST *NOLOGMSG (2)
*NOGEN *NOLONGLONG
(1)
*NOSHOWSKP *SHOWSRC *NOSHOWSYS *NOSHOWUSR *STDINC
► ►
(1) *NOSHOWSRC *SHOWSYS *SHOWUSR *NOSTDINC
*SHOWSKP
(1)
*NOSTDLOGMSG *NOSTRUCREF *NOSYSINCPATH *NOXREF *NOXREFREF
►
*STDLOGMSG (1) *SYSINCPATH *XREF *XREFREF
*STRUCREF
Notes:
1 C compiler only
2 C++ compiler only
3 Create Module command only
Note: CHECKOUT may produce many messages. To prevent these messages from going to the job log
specify OPTION(*NOLOGMSG) and the source listing option OUTPUT(*PRINT).
CHECKOUT Syntax:
CHECKOUT Details:
*NOTRUNC *NOUNUSED
►
*TRUNC *UNUSED
Notes:
1 C++ compiler only
2 C compiler only
OPTIMIZE Syntax:
10
OPTIMIZE( 20 )
30
40
10 Default setting. Generated code is not optimized. This level has the shortest compile time.
20 Some optimization is performed on the code.
30 Full optimization is performed on the generated code.
40 All optimizations done at level 30 are performed on the generated code. In addition, code is
eliminated from procedure prologue and epilogue routines that enable instruction trace and call trace
system functions. Eliminating this code enables the creation of leaf procedures. A leaf procedure
contains no calls to other procedures. Procedure call performance to a leaf procedure is significantly
faster than to a normal procedure.
Note: When specifying an INLINE option, all preceding INLINE options must also be specified,
including their defaults.
INLINE Syntax:
|
INLINE( )
*OFF
*ON
*AUTO
*NOAUTO INLINE Details
250
1-65535
*NOLIMIT 2000
1-65535
*NOLIMIT *NO
*YES
MODCRTOPT Syntax:
(1) *NOKEEPILDTA
MODCRTOPT( )
*KEEPILDTA
Notes:
1 Create Module command only
*NOKEEPILDTA
Default setting. Intermediate language data is not stored with the *MODULE object.
*KEEPILDTA
Intermediate language data is stored with the *MODULE object.
DBGVIEW Syntax:
*NONE
DBGVIEW( *ALL )
*STMT
*SOURCE
*LIST
Note: To debug an object using the *STMT option you need a spool file listing.
*SOURCE
Generates the source view for debugging the compiled object. The OPTION(*NOSHOWINC,
*SHOWINC, *SHOWSYS, *SHOWUSR) determines the content of the source view that is created.
Note: The root source should not be modified, renamed or moved after the module has been created.
It must be in the same library/file/member, in order to use this view for debugging.
*LIST
Generates the listing view for debugging the compiled object. The listing options (*EXPMAC,
*NOEXPMAC, *SHOWINC, *SHOWUSR, *SHOWSYS, *NOSHOWINC, *SHOWSKP, *NOSHOWSKP)
specified on the OPTION keyword determine the content of the listing view created, as well as the
spool file listing. If this suboption is specified together with OPTION(*FULL) or OPTION(*EXPMAC),
the compiler issues an error message and stops compilation.
| DBGENCKEY Syntax:
|
*NONE
DBGENCKEY( )
character-value
|
DEFINE Syntax:
*NONE
*NONE
Default setting. No macro is defined.
name or name=value
A maximum of 32 macros may be defined, and the maximum length of a macro is 80 characters.
Enclose each macro in single quotation marks. The quotation marks are not part of the 80 character
string and are not required when the CRTCMOD or CRTCPPMOD prompt screens are used. Single
quotation marks are required for case-sensitive macros. Separate macros with blank spaces. If value is
not specified, the compiler assigns a value of 1 to the macro.
Note: Macros, that are defined in the command, override any macro definition of the same name in the
source. A warning message is generated by the compiler. Function-like macros such as #define
max(a,b) ((a)>;(b):(a)?(b)) cannot be defined on the command.
LANGLVL Syntax:
*EXTENDED
LANGLVL( *ANSI )
(1)
*LEGACY
Notes:
1 C++ compiler only
*EXTENDED
Default setting. Defines the preprocessor variable __EXTENDED__ and undefines other
language-level variables. ISO standard C and C++, and the IBM language extensions and
system-specific features are available. This parameter should be used when all the functions of ILE C
or C++ are to be available.
*ANSI
Defines the preprocessor variables __ANSI__ and __STDC__ for C and C++ compilations,
__cplusplus98__interface__ for C++ compilations only, and undefines other language-level variables.
Only ISO standard C and C++ is available.
*LEGACY
Undefines other language-level variables. Allow constructs compatible with older levels of the C++
language.
| ALIAS Syntax:
*NOTYPEPTR
*NOALLPTRS
*NOADDRTAKEN
*ANSI
ALIAS( ▼ *NOANSI )
*ADDRTAKEN
*ALLPTRS
*TYPEPTR
|
| *ANSI|*NOANSI
| When *ANSI is in effect, type-based aliasing is used during optimization, which restricts the lvalues
| that can be safely used to access a data object. The optimizer assumes that pointers can only point to
| an object of the same type.
| When *NOANSI is in effect, the optimizer makes worst case aliasing assumptions. It assumes that a
| pointer of a given type can point to an external object or any object whose address is already taken,
| regardless of type.
| *ADDRTAKEN|*NOADDRTAKEN
| When *ADDRTAKEN is in effect, variables are disjoint from pointers unless their address is taken.
| Any class of variable for which an address has not been recorded in the compilation unit will be
| considered disjoint from indirect access through pointers.
| When *NOADDRTAKEN is specified, the compiler generates aliasing based on the aliasing rules that
| are in effect.
| *ALLPTRS|*NOALLPTRS
| When *ALLPTRS is in effect, pointers are never aliased (this also implies *TYPEPTR). Specifying
| *ALLPTRS is an assertion to the compiler that no two pointers point to the same storage location.
| The suboption *ALLPTRS is only valid if *ANSI is also specified.
| *TYPEPTR|*NOTYPEPTR
| When *TYPEPTR is in effect, pointers to different types are never aliased. Specifying *TYPEPTR is an
| assertion to the compiler that no two pointers of different types point to the same storage location.
| The suboption *TYPEPTR is only valid if *ANSI is also specified.
| Notes:
| 1. If conflicting ALIAS settings are specified, the last setting specified is used. For example, if
| ALIAS(*TYPEPTR *NOTYPEPTR) is specified, *NOTYPEPTR is used.
| 2. ALIAS makes assertions to the compiler about the code that is being compiled. If the assertions about
| the code are false, then the code generated by the compiler may result in unpredictable behaviour
| when the application is run.
| 3. The following are not subject to type-based aliasing.
| v Signed and unsigned types. For example, a pointer to a signed int can point to an unsigned int.
| v Character pointer types can point to any type
| v Types qualified as volatile or const. For example, a pointer to a const int can point to an int.
SYSIFCOPT Syntax:
(2)
*IFS64IO
(1) (3)
*NOIFSIO *NOASYNCSIGNAL
SYSIFCOPT( )
*IFSIO (3)
*ASYNCSIGNAL
Notes:
1 C compiler default setting
2 C++ compiler default setting
3 C compiler only
*IFS64IO
Default setting for the C++ compiler. The object that is created will use 64–bit Integrated File System
APIs that support C and C++ stream I/O operations on files greater than two gigabytes in size. Using
this option is equivalent to specifying SYSIFCOPT(*IFSIO *IFS64IO).
*NOIFSIO
Default setting for the C compiler. The object that is created will use the IBM i Data Management file
system for C and C++ stream I/O operations.
*IFSIO
The object that is created will use the Integrated File System APIs for C and C++ stream I/O
operations on files up to two gigabytes in size.
*NOASYNCSIGNAL
Default setting. Does not enable run-time mapping of synchronous signalling functions to
asynchronous signalling functions.
*ASYNCSIGNAL
Enable run-time mapping of synchronous signalling functions to asynchronous signalling functions.
Specifying this option causes C run-time environment to map the synchronous signal() function to
the asynchronous sigaction() function, and the synchronous raise() function to the asynchronous
kill() function.
LOCALETYPE Syntax:
*LOCALE
LOCALETYPE( *LOCALEUCS2 )
(1)
*CLD
*LOCALEUTF
Notes:
1 C compiler only
*LOCALE
Default setting. Objects compiled with this option use the locale support provided with the ILE
C/C++ compiler and run time, using locale objects of type *LOCALE. This option is only valid for
programs that run on V3R7 and later releases of the i5/OS operating system.
*LOCALEUCS2
Objects compiled with this option store wide-character literals in two-byte form in the UNICODE
CCSID (13488).
*CLD
Objects compiled with this option use the locale support provided with earlier releases of the ILE C
compiler and run time, using locale objects of type *CLD.
*LOCALEUTF
Module and program objects created with this option use the locale support provided by *LOCALE
objects. Wide-character types will contain four-byte utf-32 values. Narrow character types will contain
utf-8 values.
FLAG Syntax:
0
FLAG( 10 )
20
30
0 Default setting. All messages starting at the informational level are displayed.
10 All messages starting at the warning level are displayed.
20 All messages starting at the error level are displayed.
30 All messages starting at the severe error level are displayed.
MSGLMT Syntax:
*NOMAX 30
MSGLMT( 0 32767 0 )
10
20
*NOMAX
Default setting. Compilation continues regardless of the number of messages that have occurred at
the specified message severity level.
0 32767
Specifies the maximum number of messages that can occur at, or above, the specified message
severity level before compilation stops. The valid range is 0 to 32 767.
30 Default setting. Specifies that message-limit messages at severity 30 can occur before compilation stops.
0 Specifies that message-limit messages at severity 0 to 30 can occur before compilation stops.
10 Specifies that message-limit messages at severity 10 to 30 can occur before compilation stops.
20 Specifies that message-limit messages at severity 20 to 30 can occur before compilation stops.
REPLACE Syntax:
*YES
REPLACE( *NO )
*YES
Default setting. The existing object is replaced by the new version. The old version is moved to the
library, QRPLOBJ, and renamed based on the system date and time. The text description of the
replaced object is changed to the name of the original object. The old object is deleted at the next IPL
if it has not been deleted.
*NO
The existing object is not replaced. When an object with the same name exists in the specified library,
a message is displayed and compilation stops.
USRPRF Syntax:
(1) *USER
USRPRF( *OWNER )
Notes:
1 Create Bound Program command only
*USER
Default setting. The profile of the user that is running the program object is used.
*OWNER
The collective sets of object authority in the user profiles of both the program owner and the program
user are used to find and access objects during the program object's processing time. Objects that are
created by the program are owned by the program's user.
AUT Syntax:
*LIBCRTAUT
AUT( *CHANGE )
*USE
*ALL
*EXCLUDE
authorization-list-name
*LIBCRTAUT
Default setting. Public authority for the object is taken from the CRTAUT keyword of the target
library (the library that contains the created object). This value is determined when the object is
created. If the CRTAUT value for the library changes after the object is created, the new value does
not affect any existing objects.
*CHANGE
Provides all data authority and the authority to perform all operations on the object except those that
are limited to the owner or controlled by object authority and object management authority. The
object can be changed, and basic functions can be performed on it.
*USE
Provides object operational authority, read authority, and authority for basic operations on the object.
Users without specific authority are prevented from changing the object.
*ALL
Provides authority for all operations on the object except those that are limited to the owner or
controlled by authorization list management authority. Any user can control the object's existence,
specify its security, and perform basic functions on it, but cannot transfer its ownership.
*EXCLUDE
Users without special authority cannot access the object.
authorization-list-name
Enter the name of an authorization list of users and authorities to which the module object is added.
The object is secured by this authorization list, and the public authority for the object is set to *AUTL.
The authorization list must exist on the system when the command is issued.
TGTRLS Syntax:
*CURRENT
TGTRLS( *PRV )
release-level
*CURRENT
Default setting. The object is used on the release of the operating system that is running on your
system. For example, when V2R3M5 is running on your system, *CURRENT indicates you want to
use the object on a system with Version 2 Release 3 Modification 5 installed. You can also use the
object on a system with any subsequent release of the operating system that is installed.
Note: If V2R3M5 is running on your system, and you intend to use the object you are creating on a
system with V2R3M0 installed, specify TGTRLS(V2R3M0), not TGTRLS(*CURRENT).
*PRV
The object is used on the previous release of the operating system. For example, if V2R3M5 is being
run on the your system, specify *PRV if you want to use the object you are creating on a system with
V2R2M0 installed. You can also use the object on a system with any subsequent release of the
operating system that is installed.
release-level
Specify the release in the format VxRxMx. The object can be used on a system with the specific
release or with any subsequent release of the installed operating system. Values depend on the
current version, release, and modification level, and they change with each new release. If you specify
a release-level that is earlier than the earliest release level supported by this command, you will
receive an error message indicating the earliest supported release.
Compiling for an operating system release earlier than V5R1M0 may cause some settings of the following
compiler options to be ignored:
v “CHECKOUT” on page 88
v “OPTION” on page 82
v “OUTPUT” on page 81
v “PRFDTA” on page 110
The following options are ignored completely when compiling for an operating system release earlier
than V5R1M0:
v “CSOPT” on page 125
v “DFTCHAR” on page 127
v “DTAMDL” on page 115
v “ENUM” on page 118
v “INCDIR” on page 124
v “LICOPT” on page 126
v “MAKEDEP” on page 119
v “PACKSTRUCT” on page 117
v “PPGENOPT” on page 120
v “STGMDL” on page 114
v “TGTCCSID” on page 128
| Note: Starting in V6R1M0, this parameter no longer affects the created objects. It exists solely for
| compatibility with releases earlier than V6R1M0.
ENBPFRCOL Syntax:
*PEP
ENBPFRCOL( )
*ENTRYEXIT *ALLPRC
*FULL *NONLEAF
*PEP
| Default setting. Performance statistics are gathered on the entry and exit of the program entry
| procedure only. Choose this value when you want to gather overall performance information for an
| application. This support is equivalent to the support that was formerly provided with the TPST tool.
*ENTRYEXIT *NONLEAF
Performance statistics are gathered on the entry and exit of all the program's procedures that are not
leaf procedures. This includes the program PEP routine.
This choice is useful if you want to capture information about routines that call other routines in your
application.
*ENTRYEXIT *ALLPRC
Performance statistics are gathered on the entry and exit of all the object's procedures (including
those that are leaf procedures). This includes the program PEP routine.
This choice is useful if you want to capture information about all routines. Use this option when you
know that all the programs called by your application were compiled with either the *PEP,
*ENTRYEXIT, or *FULL option. Otherwise, if your application calls other objects that are not enabled
for performance measurement, the performance tool charges their use of resources against your
application. This makes it difficult to determine where resources are actually being used.
*FULL *NONLEAF
Performance statistics are gathered on entry and exit of all procedures that are not leaf procedures.
Statistics are gathered before and after each call to an external procedure.
*FULL *ALLPRC
Performance statistics are gathered on the entry and exit of all procedures that include leaf
procedures. Also, statistics are gathered before and after each call to an external procedure.
Use this option if your application calls other objects that were not compiled with either the *PEP,
*ENTRYEXIT, or *FULL option. This option allows the performance tools to distinguish between
resources that are used by your application and those resources used by objects it calls (even if those
objects are not enabled for performance measurement). This option is the most expensive, but allows
for selectively analyzing various programs in an application.
*NONE
No performance data is collected for this object. Use this parameter when no performance
information is needed, and a smaller object size is required.
PFROPT Syntax:
*SETFPCA *NOSTRDONLY
PFROPT( )
*NOSETFPCA *STRDONLY
*SETFPCA
Default setting. Causes the compiler to set the floating-point computational attributes to achieve the
ANSI semantics for floating-point computations.
*NOSETFPCA
No computational attributes will be set. This option is used when the object being created does not
have any floating-point computations in it.
*NOSTRDONLY
Specifies that the compiler must place strings into writable memory. This is the default.
*STRDONLY
Specifies that the compiler may place strings into read-only memory.
PRFDTA Syntax:
*NOCOL
PRFDTA( *COL )
Note: *COL has an effect only when the optimization level of the module is *FULL (30) or greater.
TERASPACE Syntax:
*NO
*NOTSIFC
TERASPACE( *YES )
*TSIFC
*NO
Default setting. The created object cannot recognize teraspace storage addresses.
| Note: Starting in V6R1M0, all modules are enabled to handle addressing of storage allocated from
| teraspace. However, if *NO is specified, the compiler facilities listed in the *YES description
| are not available.
*YES
| The created object can handle teraspace storage addresses, including parameters passed from other
| teraspace-enabled programs and service programs. In addition, the following compiler facilities are
| enabled:
| v Pointers can be qualified with __ptr64 to allow creation of 8-byte pointers used to access teraspace
| storage.
| v The teraspace storage model can be specified with the STGMDL(*TERASPACE) compiler option.
| v The LLP64 data model can be specified with the DTAMDL(*LLP64) compiler option or the
| #pragma datamodel(llp64) directive.
| v Pointer difference arithmetic returns a signed long long result instead of a ptrdiff_t result.
| *NOTSIFC
| The compiler does not use teraspace versions of storage functions, such as malloc( ) or shmat( ).
| *NOTSIFC is the default if TERASPACE(*YES) is specified.
| *TSIFC
| The compiler will use teraspace versions of storage functions, such as malloc( ) or shmat( ),
| without requiring changes to the program source code. The compiler defines the
| __TERASPACE__ macro, and maps certain storage function names to their teraspace-enabled
| equivalents. For example, selecting this compiler option causes the malloc( ) storage function to
| be mapped to _C_TS_malloc( ).
The DTAMDL (see page 115) and STGMDL (see page 114) compiler options can be used together with the
TERASPACE compiler option. Valid combinations of these options are shown in the following tables,
along with the effects of selecting those combinations.
To make the most effective use of teraspace, you can specify the following combination of options:
TERASPACE(*YES *TSIFC) STGMDL(*TERASPACE) DTAMDL(*LLP64)
For more information about teraspace storage, see Using Teraspace in IBM Rational Developer for i: ILE
C/C++ Programmer's Guide and Teraspace and single-level store in ILE Concepts.
STGMDL Syntax:
*SNGLVL
STGMDL( *TERASPACE )
*INHERIT
*SNGLVL
Default setting. The module or program uses the traditional single level storage model. Static and
automatic storage for the object is allocated from single-level store, and can only be accessed using
16-byte pointers. The module can optionally access teraspace dynamic storage if the
TERASPACE(*YES) option is specified.
*TERASPACE
The module or program uses the teraspace storage model. Teraspace storage model provides up to a
1-terabyte local address space for a single job. Static and automatic storage for the object is allocated
from teraspace and can be accessed using either 8-byte or 16-byte pointers.
*INHERIT
Valid only with the CRTCMOD and CRTCPPMOD commands. The module created can use either single
level or teraspace storage. The type of storage used depends on the type of storage required by the
caller.
For more information about valid combinations for the STGMDL, TERASPACE, and DTAMDL compiler
options, see “TERASPACE” on page 111.
For more information about the types of storage available on IBM i platforms, see Teraspace and single-level
store in ILE Concepts.
DTAMDL Syntax:
*P128
DTAMDL( *LLP64 )
*P128
Default setting. The default size of pointer variables is 16 bytes.
*LLP64
The default size of pointer variables is 8 bytes, and the compiler defines the macro __LLP64_IFC__.
Use of DTAMDL(*LLP64) together with TERASPACE(*NO) is flagged as an error by the compiler, and
compilation stops.
For more information about valid combinations for the STGMDL, TERASPACE, and DTAMDL compiler
options, see “TERASPACE” on page 111.
RTBND Syntax:
*DEFAULT
RTBND( *LLP64 )
*DEFAULT
Default setting. The object created uses the default binding directory.
*LLP64
| The object created uses the 64-bit run-time binding directory and the compiler defines the macro
| __LLP64_RTBND__.
If the data types are by default packed along boundaries smaller than those boundaries specified by
#pragma pack, they are still aligned along the smaller boundaries. For example:
v Type char is always aligned along a 1-byte boundary.
v 16-byte pointers are aligned on a 16-byte boundary. PACKSTRUCT, _Packed, and #pragma pack cannot
alter this alignment.
v 8-byte pointers can have any alignment, but 8-byte alignment is preferred.
For more information about packing and alignment, see pragma “pack” on page 55.
PACKSTRUCT Syntax:
*NATURAL
PACKSTRUCT( 1 )
2
4
8
16
*NATURAL
Default setting. The natural alignment for the members of structures is used.
1 Structures and unions are packed along 1-byte boundaries.
2 Structures and unions are packed along 2-byte boundaries.
4 Structures and unions are packed along 4-byte boundaries.
8 Structures and unions are packed along 8-byte boundaries.
16 Structures and unions are packed along 16-byte boundaries.
ENUM Syntax:
*SMALL
ENUM( 1 )
2
4
*INT
*SMALL
Default setting. Use the smallest possible size for an enum, as appropriate to the given enum value.
1 Make all enum variables 1 byte in size, signed if possible
2 Make all enum variables 2 bytes in size, signed if possible
4 Make all enum variables 4 bytes in size, signed if possible
*INT
v Use the ANSI C Standard enum size ( 4-bytes signed).
v Use the ANSI C++ Standard enum size ( 4-bytes signed; unless the enumeration value >
231-1).
MAKEDEP Syntax:
*NODEP
MAKEDEP( file-name )
*NODEP
Default setting. The option is disabled and no file is created.
file-name
Specifies an IFS path indicating the location and name of the resulting output file.
The output file contains a line for the input file and an entry for each include file. It has the general
form:
file_name.o:file_name.c file_name.o:include_file_name .
Include files are listed according to the search order rules for the #include preprocessor directive. If
an include file is not found, it is not added to the output file. Files with no include statements
produce output files containing one line that lists only the input file name.
PPGENOPT Syntax:
*NONE
PPGENOPT( )
*DFT
*GENLINE
*RMVCOMMENT
*NORMVCOMMENT *NOGENLINE
*RMVCOMMENT
*GENLINE
*NOGENLINE *NORMVCOMMENT
*NONE
Default setting. No outputs are generated by the preprocessor. Selecting this option disables the
PPSRCFILE, PPSRCMBR, and PPSRCSTMF options.
*DFT
Equivalent to specifying PPGENOPT(*RMVCOMMENT *GENLINE).
*RMVCOMMENT
Preserves comments during preprocessing.
*NORMVCOMMENT
Does not preserve comments during preprocessing.
*NOGENLINE
Suppresses #line directives in the preprocessor output.
*GENLINE
Produces #line directives in the preprocessor output.
Notes:
1. Specifying the PPGENOPT compiler option with any setting other than *NONE forces the input
of either of the following options:
v PPSRCFILE and PPSRCMBR
v PPSRCSTMF
2. Specifying PPGENOPT with any setting other than *NONE overrides the
OPTION(*NOPPONLY) and OPTION(*GEN) option settings.
3. Specifying OPTION(*PPONLY) overrides the PPGENOPT(*NONE) and OPTION(*GEN)
option settings. Instead, the following settings are implied:
v PPGENOPT(*DFT) PPSRCFILE(QTEMP/QACZEXPAND) PPSRCMBR(*MODULE) for a data
management source file.
v PPGENOPT(*DFT) PPSRCSTMF(*SRCSTMF) for an IFS source file.
PPSRCFILE Syntax:
(1) *CURLIB/
PPSRCFILE( file-name )
library-name/
Notes:
1 Create Module command only
*CURLIB
Default setting. The object is stored in the current library. If a job does not have a current library,
QGPL is used.
library-name
The name of the library where the preprocessor output is stored.
file-name
The physical file name under which the preprocessor output is stored. The file is created if it does not
already exist.
Notes:
1. The PPSRCMBR and PPSRCFILE options cannot be specified with the PPSRCSTMF option.
2. Specifying OPTION(*PPONLY) for a data management file implies the following
settings:
v PPGENOPT(*DFT) PPSRCFILE(QTEMP/QACZEXPAND) PPSRCMBR(*MODULE)
PPSRCMBR Syntax:
(1) *MODULE
PPSRCMBR( membername )
Notes:
1 Create Module command only
*MODULE
The module name that is supplied on the MODULE parameter is used as the source member name.
This is the default when a member name is not specified.
member-name
Enter the name of the member that will contain the preprocessor output.
Notes:
1. The PPSRCMBR and PPSRCFILE options cannot be specified with the PPSRCSTMF option.
2. Specifying OPTION(*PPONLY) for a data management file implies the following
settings:
v PPGENOPT(*DFT) PPSRCFILE(QTEMP/QACZEXPAND) PPSRCMBR(*MODULE)
PPSRCSTMF Syntax:
(1)
PPSRCSTMF( )
pathname
*SRCSTMF
Notes:
1 Create Module command only
path-name
Enter the IFS path of the file that will contain the preprocessor output. The path name can be either
absolutely or relatively qualified. An absolute path name starts with '/'; a relative path name starts
with a character other than '/'. If absolutely qualified, then the path name is complete. If relatively
qualified, the path name is completed by pre-pending the job's current working directory to the path
name.
*SRCSTMF
If this setting is chosen, you must also select the SRCSTMF command option. Preprocessor output is
saved to the current directory under the same base filename specified by the SRCSTMF command
option, but with a filename extension of .i.
Notes:
1. The PPSRCMBR and PPSRCFILE options cannot be specified with the PPSRCSTMF option.
2. The SRCSTMF parameter is not supported in a mixed-byte environment.
3. Specifying OPTION(*PPONLY) for an IFS file implies the following settings:
v PPGENOPT(*DFT) PPSRCSTMF(*SRCSTMF)
INCDIR Syntax:
*NONE
INCDIR( ▼ directory-name )
*NONE
Default setting. No directories are inserted at the start of the default user include path.
directory-name
Specifies a directory name to be inserted at the start of the default user include path. More than one
directory name can be entered. Directories are inserted at the start of the default user include path in
the order they are entered.
CSOPT Syntax:
*NONE
CSOPT( )
' compiler-service-options-string '
*NONE
Default setting. No compiler service options selected.
compiler-servicing-options-string
Specified compiler service options are used when creating a module object.
LICOPT Syntax:
*NONE
LICOPT( )
' Licensed-Internal-Code-Options-String '
DFTCHAR Syntax:
*UNSIGNED
DFTCHAR( *SIGNED )
*UNSIGNED
Default setting. Treats all variables declared as type char as type unsigned char. The
_CHAR_UNSIGNED macro is defined.
*SIGNED
Treats all variables declared as type char as type signed char, and defines the _CHAR_SIGNED
macro. This setting is ignored if the TGTRLS option specifies a target release earlier than V5R1M0.
If an ASCII CCSID is entered, the compiler issues an error message and assumes a CCSID of 37.
If an ASCII CCSID is entered, the compiler issues no error message. Translation occurs to the ASCII
CCSID but the created module has a CCSID of 65535.
The TGTCCSID option will also determine the CCSID of character values used in listings. However,
listings sent to a spool file will be in the job's CCSID because that is the CCSID of the spool file.
This option is ignored when targeting a compile for a release previous to V5R1.
TGTCCSID Syntax:
*SOURCE
TGTCCSID( *JOB )
*HEX
coded-character-set-identifier
*SOURCE
Default setting. The CCSID of the root source file is used.
*JOB
The CCSID of the current job is used.
*HEX
The CCSID 65535 is used, indicating that character data is treated as bit data and is not converted.
coded-character-set-identifier
Specifies a specific CCSID to be used.
TEMPLATE Syntax:
TEMPLATE Details:
*TEMPINC 1 *NO
directory-pathname
1 65535 *WARN
*ERROR
Notes:
1 C++ compiler only
2 Create Module command only
3 Applicable only when using the Integrated File System (IFS)
Note: This can cause code duplication in program executables where template specifications are used
in more than one module.
*TEMPINC
Templates are generated into a directory named tempinc which is created in the directory where the
root source file was found. If the source file is not a stream file, a file named TEMPINC will be
created in the library where the source file resides. The TEMPLATE(*TEMPINC) and TMPLREG
options are mutually exclusive.
directory-pathname
Same as *TEMPLATE(*TEMPINC), except that template instantiation files are generated to a specified
directory location. The directory path can be relative to the current directory, or it can be an absolute
directory path.
If the specified directory does not exist, it is created.
Note:
An error condition results if the specified directory path contains a directory that does not exist, for
example, TEMPLATE(/source/subdir1/tempinc) when subdir1 does not exist.
1 65535
Specifies the maximum number of template include files to be generated by the
*TEMPLATE(*TEMPINC) option for each header file. If not specified, this setting defaults to 1. The
maximum value for this setting is 65535.
Note: Regardless of the setting of this and the next two options, error messages are produced for
problems that appear outside implementations. For example, errors found during the parsing
or semantic checking of constructs such as the following, always cause error messages:
v return type of a function template
v parameter list of a function template
v member list of a class template
v base specifier of a class template
*WARN
Parses template implementations and issues warning messages for semantic errors. Error messages
are also issued for errors found while parsing.
*ERROR
Treats problems in template implementations as errors, even if the template is not instantiated.
Valid only with the CRTCPPMOD command. Maintains a record of all templates as they are encountered in
the source and ensures that only one instantiation of each template is made. The TMPLREG and
TEMPLATE(*TEMPINC) parameters are mutually exclusive.
TMPLREG Syntax:
Notes:
1 C++ compiler only
2 Create Module command only
3 Applicable only when using the Integrated File System (IFS)
Specifies whether weak definitions are used for static members of a template class. Weakly defined static
members of a template class will prevent the collisions of multiple definitions in a program or service
program.
WEAKTMPL Syntax:
*YES
WEAKTMPL( *NO )
Some programs require strong static data members when they are linked to other modules. You can
override the default only at compilation time.
| DECFLTRND Syntax:
|
*HALFEVEN
DECFLTRND( *DOWN )
*UP
*HALFUP
*HALFDOWN
*FLOOR
*CEILING
|
►► ixlc ▼ ►
-? -c -+ -prtmsgid pgm_source compiler_opts
► ►◄
-B " binder_cmd "
where:
ixlc Basic compiler command invocation. By default, the ixlc command instructs the compiler to
create a bound program.
-? Specifying this flag displays help for the ixlc command.
-c Specifying this flag instructs the compiler to create a module.
-+ Specifying this flag invokes the C++ compiler.
| -prtmsgid
| Specifying this flag causes additional information on compiler error messages to be displayed.
| The additional information includes the line number, column number, message identifier, and
| message severity.
pgm_source
Specifies the name of the program source file being compiled. You can compile an IFS source
program or data management source program by providing the source name as:
qsys.lib/.../name.mbr
Alternately, you can also compile a data management source program by using the
-qsrcfile(library/file) and -qsrcmbr(member) Qshell compiler options to identify the location
of the program source.
Notes on Usage
1. ixlc commands and options are case sensitive.
2. It is possible to specify conflicting options when invoking the compiler. If this occurs, options
specified later on the command line will override options specified earlier. For example, invoking the
compiler by specifying :
ixlc hello.c -qgen -qnogen
is equivalent to specifying:
ixlc hello.c -qnogen
3. Some option settings are cumulative, and can be specified more than once on the command line
without cancelling out earlier specifications of that same option. These options include:
v settings within the OPTION compiler option group
v settings within the CHECKOUT compiler option group
v ALIAS compiler option
v DEFINE compiler option
v PPGENOPT compiler option
Chapter 4. Using the ixlc Command to Invoke the C/C++ Compiler 137
Table 5. ixlc Command Options (continued)
Create Module/Create
Option Settings ixlc Equivalents and Notes
Bound Program Options
“CHECKOUT” on page 88 *NONE | *USAGE | *ALL -qinfo=cnd
-qinfo=all
*CLASS | *NOCLASS -qinfo=cls
*COND | *NOCOND -qinfo=cnd
*CONST | *NOCONST -qinfo=cns
*EFFECT | *NOEFFECT -qinfo=eff
*ENUM | *NOENUM -qinfo=enu
*EXTERN | *NOEXTERN -qinfo=ext
*GENERAL | *NOGENERAL -qinfo=gen
*GOTO | *NOGOTO -qinfo=got
*INIT | *NOINIT -qinfo=ini
*LANG | *NOLANG -qinfo=lan
*PARM | *NOPARM -qinfo=par
*PORT | *NOPORT -qinfo=por
*PPCHECK | *NOPPCHECK -qinfo=ppc
*PPTRACE | *NOPPTRACE -qinfo=ppt
*REACH | *NOREACH -qinfo=rea
*TEMP | *NOTEMP -qinfo=gnr
*TRUNC | *NOTRUNC -qinfo=trd
*UNUSED | *NOUNUSED -qinfo=use
“OPTIMIZE” on page 91 10 | 20 | 30 | 40 -qoptimize=10
-qoptimize=20
-qoptimize=30
-qoptimize=40
-O
-O is equivalent to specifying
-qoptimize=40
Chapter 4. Using the ixlc Command to Invoke the C/C++ Compiler 139
Table 5. ixlc Command Options (continued)
Create Module/Create
Option Settings ixlc Equivalents and Notes
Bound Program Options
“SYSIFCOPT” on page 100 *NOIFSIO | **IFSIO | *IFS64IO -qnoifsio
-qifsio
-qifsio=64
*ASYNCSIGNAL | *NOASYNCSIGNAL -qasyncsignal
-qnoasyncsignal
“LOCALETYPE” on page *LOCALE | *LOCALEUCS2 | *LOCALEUTF | *CLD -qlocale=locale
101 -qlocale=localeucs2
-qlocale=localeutf
-qlocale=cld
“FLAG” on page 102 0 | 10 | 20 | 30 -qflag=0
-qflag=10
-qflag=20
-qflag=30
“MSGLMT” on page 103 *NOMAX | 0-32767 -qmsglmt="limit severity" where:
30 | 0 | 10 | 20 limit can be *nomax or any integer
from 0-32767, and severity can be any
one of 0, 10, 20, or 30. The default is:
-qmsglmt="*nomax 30"
“REPLACE” on page 104 *YES | *NO -qreplace
-qnoreplace
“USRPRF” on page 105 *USER | *OWNER -quser
-qowner
“AUT” on page 106 *LIBCRTAUT | *CHANGE | *USE | *ALL | -qaut=libcrtaut
*EXCLUDE -qaut=change
-qaut=use
-qaut=all
-qaut=exclude
“TGTRLS” on page 107 *CURRENT | *PRV | release_lvl -qtgtrls=*current
-qtgtrls=*prv
-qtgtrls=VxRxMx
“ENBPFRCOL” on page 108 *PEP -qenbpfrcol=pep
*ENTRYEXIT *NONLEAF -qenbpfrcol=entryexitnonleaf
*ENTRYEXIT *ALLPRC -qenbpfrcol=entryexitallprc
*FULL *NONLEAF -qenbpfrcol=fullnonleaf
*FULL *ALLPRC -qenbpfrcol=fullallprc
“PFROPT” on page 109 *SETFPCA | *NOSETFPCA -qsetfpca
-qnosetfpca
*NOSTRDONLY | *STRDONLY -qnoro
-qro
“PRFDTA” on page 110 *NOCOL | *COL -qnoprofile
-qprofile
-qprfdta=*NOCOL
-qprfdta=*COL
“TERASPACE” on page 111 *NO -qteraspace=no
*YES *NOTSIFC -qteraspace=notsifc
*YES *TSIFC -qteraspace=tsifc
Chapter 4. Using the ixlc Command to Invoke the C/C++ Compiler 141
Table 5. ixlc Command Options (continued)
Create Module/Create
Option Settings ixlc Equivalents and Notes
Bound Program Options
“TEMPLATE” on page 129 *NONE | pathname -qnotempinc
-qtempinc=pathname
1 - 65535 -qtempmax=1-65535
*NO | *WARN | *ERROR -qtmplparse=no
-qtmplparse=warn
-qtmplparse=error
“TMPLREG” on page 131 *DFT | *NONE -qtmplreg
-qnotmplreg
“WEAKTMPL” on page 132 *YES | *NO -qweaktmpl
-qnoweaktmpl
| “DECFLTRND” on page 133 *HALFEVEN | *DOWN | *UP | *HALFUP | -ydn
*HALFDOWN | *FLOOR | *CEILING -ydz
-ydi
-ydna
-ydnz
-ydm
-ydp
For more information about data management operations and ILE C/C++ functions available for stream
files, see the Database file management section in the Files and file systems category at the i5/OS Information
Center Web site:
http://www.ibm.com/systems/i/infocenter
You can find more information in the DDS Reference, available in PDF and HTML formats from the i5/OS
Information Center Web site at:
http://www.ibm.com/systems/i/infocenter
IBM may not offer the products, services, or features discussed in this document in other countries.
Consult your local IBM representative for information on the products and services currently available in
your area. Any reference to an IBM product, program, or service is not intended to state or imply that
only that IBM product, program, or service may be used. Any functionally equivalent product, program,
or service that does not infringe any of IBM intellectual property right may be used instead. However, it
is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or
service.
IBM may have patents or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents. You can send license
inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property
Department in your country or send inquiries, in writing, to:
Intellectual Property Licensing
Legal and Intellectual Property Law
IBM Japan, Ltd.
3-2-12, Roppongi, Minato-ku, Tokyo 106-8711
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some
states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this
statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically
made to the information herein; these changes will be incorporated in new editions of the publication.
IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this
publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in
any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of
the materials for this IBM product and use of those Web sites is at your own risk.
Licensees of this program who wish to have information about it for the purpose of enabling: (i) the
exchange of information between independently created programs and other programs (including this
one) and (ii) the mutual use of the information which has been exchanged, should contact:
IBM Corporation
Software Interoperability Coordinator, Department YBWA
3605 Highway 52 N
Such information may be available, subject to appropriate terms and conditions, including in some cases
payment of a fee.
The licensed program described in this document and all licensed material available for it are provided
by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement,
IBM License Agreement for Machine Code, or any equivalent agreement between us.
This information contains examples of data and reports used in daily business operations. To illustrate
them as completely as possible, the examples include the names of individuals, companies, brands, and
products. All of these names are fictitious and any similarity to the names and addresses used by an
actual business enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs
in any form without payment to IBM, for the purposes of developing, using, marketing or distributing
application programs conforming to the application programming interface for the operating platform for
which the sample programs are written. These examples have not been thoroughly tested under all
conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these
programs. The sample programs are provided "AS IS", without warranty of any kind. IBM shall not be
liable for any damages arising out of your use of the sample programs.
Each copy or any portion of these sample programs or any derivative work, must include a copyright
notice as follows:
© (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. ©
Copyright IBM Corp. _enter the year or years_.
If you are viewing this information softcopy, the photographs and color illustrations may not appear.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other
countries, or both.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the
United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Industry Standards
The Integrated Language Environment C/C++ compiler and run-time library are designed according to
the ANSI for C Programming Languages - C ANSI/ISO 9899-1990 standard, and the November 1997
ANSI C++ Draft Standard.
Notices 151
152 ILE C/C++ Compiler Reference
Index
Special characters __wchar_t 5
_C99_PRAGMA_OPERATOR 3
__ANSI__ 2 _LARGE_FILE_API 4
__ASYNC_SIG__ 2 _LARGE_FILES 4
__BASE_FILE__ 2 _LONG_LONG 4
__BOOL__ 2
__C99_COMPOUND_LITERAL 2
__C99_CPLUSCMT 2
__C99_FUNC__ 3 A
__C99_HEX_FLOAT_CONST 3 argopt pragma 11
__C99_MACRO_WITH_VA_ARGS 3 argument optimization
__C99_RESTRICT 3 scoping 12
__C99_VARIABLE_LENGTH_ARRAY 3 argument pragma 13
__CHAR_SIGNED__ 2
__CHAR_UNSIGNED__ 2
__cplusplus 1 C
__cplusplus98__interface__ 2 cancel_handler pragma 15
__DATE__ 1 chars pragma 16
__DIGRAPHS__ 3 checkout pragma 17
__EXTENDED__ 3 comment pragma 18
__FILE__ 1 control characters 145
__FUNCTION__ 3 Control Language commands
__HHW_AS400__ 3 CRTBNDC 69
__HOS_OS400__ 3 CRTBNDCPP 69
__IBM_ALIGN 3 CRTCMOD 69
__IBM_ATTRIBUTES 3 CRTCPPMOD 69
__IBM_COMPUTED_GOTO 3 options
__IBM_DFP__ 3 ALIAS 99
__IBM_EXTENSION_KEYWORD 4 AUT 106
__IBM_INCLUDE_NEXT 4 CHECKOUT 88
__IBM_LABEL_VALUE 4 CSOPT 125
__IBM_LOCAL_LABEL 4 DBGENCKEY 96
__IBM_MACRO_WITH_VA_ARGS 4 DBGVIEW 95
__IBM_TYPEOF__ 4 DECFLTRND 133
__IBMC__ 3 DEFINE 97
__IBMCPP__ 3 DFTCHAR 127
__IFS_IO__ 4 DTAMDL 115
__IFS64_IO__ 4 ENBPFRCOL 108
__ILEC400__ 4 ENUM 118
__ILEC400_TGTVRM__ 4 FLAG 102
__LINE__ 1 INCDIR 124
__LLP64_IFC__ 4 INLINE 92
__LLP64_RTBND__ 4 LANGLVL 98
__LONGDOUBLE64 4 LICOPT 126
__NO_RTTI__ 4 LOCALETYPE 101
__OPTIMIZE__ 4 MAKEDEP 119
__OS400__ 5 MODCRTOPT 94
__OS400_TGTVRM__ 5 MODULE 76
__POSIX_LOCALE__ 5 MSGLMT 103
__RTTI_DYNAMIC_CAST__ 5 OPTIMIZE 91
__RTTI_TYPE_INFO__ 5 OPTION 82
__SIZE_TYPE__ 5 OUTPUT 81
__SRCSTMF__ 5 PACKSTRUCT 117
__STDC__ 1 PFROPT 109
__STDC_VERSION 1 PGM 76
__TERASPACE__ 5 PPGENOPT 120
__THW_AS400__ 5 PPSRCFILE 121
__TIME__ 1 PPSRCMBR 122
__TIMESTAMP__ 5 PPSRCSTMF 123
__TOS_OS400__ 5 PRFDTA 110
__UCS2__ 5 REPLACE 104
__UTF32__ 5
S
O sequence pragma 65
operational descriptor pragma 22 single level storage model 111
stream type 143
strings pragma 66
P structures
packing
pack pragma 55
using #pragma pack 55
page pragma 61
pagesize pragma 62
pointer pragma 63
pragma 11 T
argopt 11 templates
argument 13 pragma define 21
cancel_handler 15 pragma implementation 35
chars 16 teraspace 111
checkout 17
comment 18
convert 19
datamodel 20
U
unions
define 21
packing
disable_handler 24
using #pragma pack 55
disjoint 25
do_not_instantiate 26
enum 27
exception_handler 31 W
hashome 34 weak pragma 67
implementation 35
info 36
inline 37
ishome 38
isolated_call 39
linkage 40
map 42
mapinc 44
margins 46
namemangling 47
namemanglingrule 48
noargv0 50
noinline 51
Index 155
156 ILE C/C++ Compiler Reference
Readers’ Comments — We'd Like to Hear from You
IBM Rational Developer for i:
ILE C/C++ Compiler Reference
7.1
We appreciate your comments about this publication. Please comment on specific errors or omissions, accuracy,
organization, subject matter, or completeness of this book. The comments you send should pertain to only the
information in this manual or product and the way in which the information is presented.
For technical questions and information about products and prices, please contact your IBM branch office, your
IBM business partner, or your authorized remarketer.
When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any
way it believes appropriate without incurring any obligation to you. IBM or any other organizations will only use
the personal information that you supply to contact you about the issues that you state on this form.
Comments:
If you would like a response from IBM, please fill in the following information:
Name Address
Company or Organization
_ _ _ _ _ _ _Fold
_ _ _and
_ _ _Tape
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Please
_ _ _ _ _do
_ _not
_ _ staple
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Fold
_ _ _and
_ _ Tape
______
NO POSTAGE
NECESSARY
IF MAILED IN THE
UNITED STATES
IBM CORPORATION
Attn Bldg 004-2 ID Clerk
3605 HWY 52 N
ROCHESTER MN 55901-7829
_________________________________________________________________________________________
Fold and Tape Please do not staple Fold and Tape
Cut or Fold
SC09-4816-05 Along Line
IBM®
SC09-4816-05