extended |
Compilation is based on the ISO C++
Standard, with some differences
to accommodate extended language features. |
[no]anonstruct |
This suboption controls whether anonymous structs and
anonymous classes are allowed in your C++ source.
By default, the compiler
allows anonymous structs. This is an extension to the C++ standard and gives
behavior that is compatible with the C++ compilers provided by Microsoft(R) Visual
C++.
Anonymous structs typically are used in unions, as in the following
code fragment:
union U {
struct {
int i:16;
int j:16;
};
int k;
} u;
// ...
u.j=3;
When this suboption is set, you receive a warning if your code
declares an anonymous struct and -qinfo=por is specified.
When you build with -qlanglvl=noanonstruct, an anonymous
struct is flagged as an error. Specify noanonstruct for
compliance with standard C++. |
[no]anonunion |
This suboption controls what members are allowed in
anonymous unions.
When this suboption is set to anonunion, anonymous unions can have members of all types that standard C++ allows
in non-anonymous unions. For example, non-data members, such as structures,
typedefs, and enumerations are allowed.
Member functions, virtual functions,
or objects of classes that have non-trivial default constructors, copy constructors,
or destructors cannot be members of a union, regardless of the setting of
this option.
By default, the compiler allows non-data members in anonymous
unions. This is an extension to standard C++ and gives behavior that is compatible
with the C++ compilers provided by previous versions of VisualAge C++ and
predecessor products, and Microsoft Visual C++.
When this option is
set to anonunion, you receive a warning if your code
uses the extension, unless you suppress the arning message with the -qsuppress option.
Set noanonunion for compliance
with standard C++. |
[no]ansifor |
This suboption controls whether scope rules defined in
the C++ standard apply to names declared in for-init statements.
By default,
standard C++ rules are used. For example the following code causes a name
lookup error:
{
//...
for (int i=1; i<5; i++) {
cout << i * 2 << endl;
}
i = 10; // error
}
The reason for the error is that i, or any name declared
within a for-init-statement, is visible only within the for statement. To
correct the error, either declare i outside the loop or set ansiForStatementScopes
to no.
Set noansifor to allow old language behavior.
You may need to do this for code that was developed with other products, such
as the compilers provided by earlier versions of VisualAge C++ and predecessor
products, and Microsoft Visual C++. |
[no]ansisinit |
This option works in the same way
as g++ -fuse-cxa-atexit and is
required for fully standards-compliant handling of static destructors. |
[no]c99__func__ |
This suboption instructs the compiler to recognize the
C99 __func__ identifier. The __func__ identifier behaves
as if there is an implicit declaration like:
static const char __func__[] = function_name;
where function_name is the name of the function
in which the __func__ identifier appears.
The effect of the __func__ identifier can be seen in the following code segment:
void this_function()
{
printf("__func__ appears in %s", __func__);
} which outputs the following when run:
__func__ appears in this_function
The c99__func__ suboption is enabled by
default when -qlanglvl=extended is in effect. It can
be enabled for any language level by specifying -qlanglvl=c99__func__, or disabled by specifying -qlanglvl=noc99__func__.
The __C99__FUNC__ macro is defined to be 1 when c99__func__ is in effect, and is undefined otherwise. |
[no]c99complex |
This suboption instructs the compiler to recognize C99
complex data types and related keywords.
Note:
Support for complex
data types may vary among different C++ compilers, creating potential portability
issues. The compiler will issue a portability warning message if you specify
this compiler option together with -qinfo=por. |
[no]c99compoundliteral |
This suboption instructs the compiler to support the
C99 compound literal feature. |
[no]c99hexfloat |
This option enables support for C99-style hexadecimal
floating constants in C++ applications. This suboption is on by default for -qlanglvl=extended. When it is in effect, the compiler defines
the macro __C99_HEX_FLOAT_CONST. |
[no]c99vla |
When c99vla is in effect, the
compiler will support the use of C99-type variable length arrays in your C++
applications. The macro __C99_VARIABLE_LENGTH_ARRAY is defined with a value
of 1.
Note:
In C++ applications, storage allocated for use by variable
length arrays is not released until the function they reside in completes
execution. |
[no]dependentbaselookup |
The default is -qlanglvl=dependentbaselookup.
This suboption provides the ability to specify compilation in conformance
with Issue 213 of TC1 of the C++ Standard.
The default setting retains
the behavior of previous XL C/C++ compilers with regard to the name lookup
for a template base class of dependent type: a member of a base class that
is a dependent type hides a name declared within a template or any name from
within the enclosing scope of the template.
For compliance with TC1,
specify -qlanglvl=nodependentbaselookup. |
[no]gnu_assert |
GNU C portability option to enable or disable support
for the following GNU C system identification assertions:
- #assert
- #unassert
- #cpu
- #machine
- #system
|
[no]gnu_complex |
This suboption instructs the compiler to recognize GNU
complex data types and related keywords.
Note:
Support for complex
data types may vary among different C++ compilers, creating potential portability
issues. The compiler will issue a portability warning message if you specify
this compiler option together with -qinfo=por. |
[no]gnu_computedgoto |
GNU C portability option to enable support for computed
gotos. This suboption is enabled for -qlanglvl=extended,
and defines the macro __IBM_COMPUTED_GOTO. |
[no]gnu_externtemplate |
This suboption enables or disables extern template instantiations.
The default setting is gnu_externtemplate when compiling
to the extended language level.
If gnu_externtemplate is in effect, you can declare a template instantiation
to be extern by adding the keyword extern in front of an explicit
C++ template instantiation. The extern keyword must be the first
keyword in the declaration, and there can be only one extern keyword.
This does not instantiate the class or function. For both classes
and functions, the extern template instantiation will prevent instantiation
of parts of the template, provided that instantiation has not already been
triggered by code prior to the extern template instantiation, and it is not
explicitly instantiated nor explicitly specialized.
For classes, static
data members and member functions will not be instantiated, but a class itself
will be instantiated if required to map the class. Any required compiler generated
functions (for example, default copy constructor) will be instantiated. For
functions, the prototype will be instantiated but the body of the template
function will not.
See the following examples:
template < class T > class C {
static int i;
void f(T) { }
};
template < class U > int C<U>::i = 0;
extern template class C<int>; // extern explicit
// template
// instantiation
C<int> c; // does not cause instantiation of
// C<int>::i or C<int>::f(int) in
// this file but class is
// instantiated for mapping
C<char> d; // normal instantiations
==========================
template < class C > C foo(C c) { return c; }
extern template int foo<int>(int); // extern explicit
// template
// instantiation
int i = foo(1); // does not cause instantiation
// of body of foo<int>
|
[no]gnu_include_next |
GNU C portability option to enable or disable support
for the GNU C #include_next preprocessor directive. |
[no]gnu_labelvalue |
GNU C portability option to enable or disable support
for labels as values. This suboption is on by default for -qlanglvl=extended, and defines the macro __IBM_LABEL_VALUE. |
[no]gnu_locallabel |
GNU C portability option to enable or disable support
for locally-declared labels. |
gnu_membernamereuse |
GNU C++ portability option to enable reusing a template
name in a member list as a typedef. |
[no]gnu_suffixij |
GNU C portability option to enable or disable support
for GNU-style complex numbers. If gnu_suffixij is specified,
a complex number can be ended with suffix i/I or j/J. |
[no]gnu_varargmacros |
This option is similar to -qlanglvl=varargmacros. The main differences are:
- An optional variable argument identifier may precede the ellipsis, allowing
that identifier to be used in place of the macro __VA_ARGS__ . Whitespace
may appear between the identifier and the ellipsis.
- The variable argument can be omitted.
- If the token paste operator (##) appears between
the comma and the variable argument, the preprocessor removes the dangling
comma (,) if the variable argument is not provided.
- The macro __IBM_MACRO_WITH_VA_ARGS is defined to 1.
Example 1 - Simple substitution:
#define debug(format, args...) printf(format, args)
debug("Hello %s\n", "Chris"); preprocesses to:
printf("Hello %s\n", "Chris");
Example 2 - Omitting the variable argument:
#define debug(format, args...) printf(format, args)
debug("Hello\n"); preprocesses to the following, leaving a dangling
comma:
printf("Hello\n",);
Example 3 - Using the token
paste operator to remove a dangling comma when the variable argument is omitted:
#define debug(format, args...) printf(format, ## args)
debug("Hello\n"); preprocesses to:
printf("Hello\n"); |
[no]gnu_warning |
GNU C portability option to enable or disable support
for the GNU C #warning preprocessor directive. |
[no]illptom |
This suboption controls what expressions can be used to
form pointers to members. The XL C++ compiler can accept some forms that
are in common use but do not conform to the C++ Standard.
By default,
the compiler allows these forms. This is an extension to standard C++ and
gives behavior that is compatible with the C++ compilers provided by earlier
versions of VisualAge C++, its predecessor products, and Microsoft Visual
C++.
When this suboption is set to illptom, you
receive warnings if your code uses the extension, unless you suppress the
warning messages with the -qsuppress option.
For example, the following code defines a pointer to a function member, p, and initializes it to the address of C::foo, in the old
style:
struct C {
void foo(int);
};
void (C::*p) (int) = C::foo;
Set noillptom for
compliance with the C++ standard. The example code above must be modified
to use the & operator.
struct C {
void foo(int);
};
void (C::*p) (int) = &C::foo; |
[no]implicitint |
This suboption controls whether the compiler will accept
missing or partially specified types as implicitly specifying int. This is
no longer accepted in the standard but may exist in legacy code.
With
the suboption set to noimplicitint, all types must be
fully specified.
With the suboption set to implicitint, a function declaration at namespace scope or in a member list will
implicitly be declared to return int. Also, any declaration specifier
sequence that does not completely specify a type will implicitly specify an
integer type. Note that the effect is as if the int specifier were
present. This means that the specifier const, by itself, would
specify a constant integer.
The following specifiers do not completely
specify a type:
- auto
- const
- extern
- extern "<literal>"
- inline
- mutable
- friend
- register
- static
- typedef
- virtual
- volatile
- platform specific types (for example, _cdecl)
Note that any situation where a type is specified is affected by this
suboption. This includes, for example, template and parameter types, exception
specifications, types in expressions (eg, casts, dynamic_cast, new),
and types for conversion functions.
By default, the compiler sets -qlanglvl=implicitint. This is an extension to the C++ standard
and gives behavior that is compatible with the C++ compilers provided by earlier
versions of VisualAge C++ and predecessor products, and Microsoft Visual C++.
For example, the return type of function MyFunction is int because it was omitted in the following code:
MyFunction()
{
return 0;
}
Set -qlanglvl=noimplicitint for compliance
with standard C++. For example, the function declaration above must be modified
to:
int MyFunction()
{
return 0;
} |
[no]offsetnonpod |
This suboption controls whether the offsetof macro
can be applied to classes that are not data-only. C++ programmers often casually
call data-only classes "Plain Old Data" (POD) classes.
By default,
the compiler allows offsetof to be used with non-POD classes. This
is an extension to the C++ standard, and gives behavior that is compatible
with the C++ compilers provided by VisualAge C++ for OS/2(R) 3.0, VisualAge
for C++ for Windows(R), Version 3.5, and Microsoft Visual C++
When this option is set, you receive a warning if your code uses the extension,
unless you suppress the warning message with the -qsuppress option.
Set -qlanglvl=nooffsetnonpod for
compliance with standard C++.
Set -qlanglvl=offsetnonpod if your code applies offsetof to a class that contains one
of the following:
- user-declared constructors or destructors
- user-declared assignment operators
- private or protected non-static data members
- base classes
- virtual functions
- non-static data members of type pointer to member
- a struct or union that has non-data members
- references
|
[no]olddigraph |
This option controls whether old-style digraphs are allowed
in your C++ source. It applies only when -qdigraph is
also set.
By default, the compiler supports only the digraphs specified
in the C++ standard.
Set -qlanglvl=olddigraph if
your code contains at least one of following digraphs:
- Digraph
- Resulting character
- %%
- # (pound sign)
- %%%%
- ## (double pound sign, used as the preprocessor macro concatenation
operator)
Set -qlanglvl=noolddigraph for compatibility
with standard C++ and the extended C++ language level supported by previous
versions of VisualAge C++ and predecessor products. |
[no]oldfriend |
This option controls whether friend declarations that
name classes without elaborated class names are treated as C++ errors.
By default, the compiler lets you declare a friend class without elaborating
the name of the class with the keyword class. This is an extension to the
C++ standard and gives behavior that is compatible with the C++ compilers
provided by earlier versions of VisualAge C++ and predecessor products, and
Microsoft Visual C++.
For example, the statement below declares the
class IFont to be a friend class and is valid when the oldfriend suboption is set specified.
friend IFont;
Set the nooldfriend suboption for compliance with standard C++.
The example declaration above causes a warning unless you modify it to the
statement as below, or suppress the warning message with -qsuppress option.
friend class IFont; |
[no]oldtempacc |
This suboption controls whether access to a copy constructor
to create a temporary object is always checked, even if creation of the temporary
object is avoided.
By default, the compiler suppresses the access checking.
This is an extension to the C++ standard and gives behavior that is compatible
with the C++ compilers provided by VisualAge C++ for OS/2 3.0, VisualAge for
C++ for Windows, Version 3.5, and Microsoft Visual C++.
When this suboption
is set to yes, you receive a warning if your code uses the extension, unless
you disable the warning message with the -qsuppress option.
Set -qlanglvl=nooldtempacc for compliance with
standard C++. For example, the throw statement in the following code causes
an error because the copy constructor is a protected member of class C:
class C {
public:
C(char *);
protected:
C(const C&);
};
C foo() {return C("test");} // return copy of C object
void f()
{
// catch and throw both make implicit copies of
// the thrown object
throw C("error"); // throw a copy of a C object
const C& r = foo(); // use the copy of a C object
// created by foo()
}
The example code above contains three ill formed uses of the copy
constructor C(const C&). |
[no]oldtmplalign |
This suboption specifies the alignment rules implemented
in versions of the compiler (xlC) prior to Version 5.0.
These earlier versions of the xlC compiler ignore alignment rules specified
for nested templates. By default, these alignment rules are not ignored in
VisualAge C++ 4.0 or later. For example, given the following template the
size of A<char>::B will be 5 with -qlanglvl=nooldtmplalign, and 8 with -qlanglvl=oldtmplalign :
template <class T>
struct A {
#pragma options align=packed
struct B {
T m;
int m2;
};
#pragma options align=reset
}; |
[no]oldtmplspec |
This suboption controls whether template specializations
that do not conform to the C++ standard are allowed.
By default, the compiler
allows these old specializations (-qlanglvl=nooldtmplspec). This is an extension to standard C++ and gives behavior that is compatible
with the C++ compilers provided by VisualAge C++ for OS/2 3.0, VisualAge for
C++ for Windows, Version 3.5, and Microsoft Visual C++.
When -qlanglvl=oldtmplspec is set, you receive a warning if your code uses
the extension, unless you suppress the warning message with the -qsuppress option.
For example, you can explicitly specialize the
template class ribbon for type char with the following lines:
template<class T> class ribbon { /*...*/};
class ribbon<char> { /*...*/};
Set -qlanglvl=nooldtmplspec for compliance with standard C++. In the example above, the template
specialization must be modified to:
template<class T> class ribbon { /*...*/};
template<> class ribbon<char> { /*...*/}; |
[no]redefmac |
Specifies whether a macro can be redefined without a
prior #undef or undefine() statement. |
[no]trailenum |
This suboption controls whether trailing commas are allowed
in enum declarations.
By default, the compiler allows one or
more trailing commas at the end of the enumerator list. This is an extension
to the C++ standard, and provides compatibility with Microsoft Visual C++.
The following enum declaration uses this extension:
enum grain { wheat, barley, rye,, };
Set -qlanglvl=notrailenum for compliance with
standard C++ or with the stdc89 language level supported
by previous versions of VisualAge C++ and predecessor products. |
[no]typedefclass |
This suboption provides backwards compatibility with previous
versions of VisualAge C++ and predecessor products.
The current C++ standard
does not allow a typedef name to be specified where a class name is expected.
This option relaxes that restriction. Set -qlanglvl=typedefclass to allow the use of typedef names in base specifiers and constructor
initializer lists.
By default, a typedef name cannot be specified where
a class name is expected. |
[no]ucs |
This suboption controls whether Unicode characters are
allowed in identifiers, string literals and character literals in C++ sources.
The default setting is -qlanglvl=noucs.
The Unicode
character set is supported by the C++ standard. This character set contains
the full set of letters, digits and other characters used by a wide range
of languages, including all North American and Western European languages.
Unicode characters can be 16 or 32 bits. The ASCII one-byte characters are
a subset of the Unicode character set.
When -qlanglvl=ucs is enabled, you can insert Unicode characters in your source files either
directly or using a notation that is similar to escape sequences. Because
many Unicode characters cannot be displayed on the screen or entered from
the keyboard, the latter approach is usually preferred. Notation forms for
Unicode characters are \uhhhh for 16-bit characters,
or \Uhhhhhhhh for 32-bit characters, where h represents a hexadecimal digit. Short identifiers of characters are
specified by ISO/IEC 10646. |
[no]varargmacros |
This C99 feature allows the use of a variable argument
list in function-like macros in your C++ applications. The syntax is similar
to a variable argument function, and can be used as a masking macro for printf.
For example:
#define debug(format, ...) printf(format, __VA_ARGS__)
debug("Hello %s\n", "Chris"); preprocesses to::
printf("Hello %s\n", "Chris"); The token __VA_ARGS__ in the replacement list corresponds to the ellipsis
in the parameter. The ellipsis represents the variable arguments in a macro
invocation.
Specifying varargmacros defines the
macro __C99_MACRO_WITH_VA_ARGS to a value of 1. |
[no]zeroextarray |
This suboption controls whether zero-extent arrays are
allowed as the last non-static data member in a class definition.
By default,
the compiler allows arrays with zero elements. This is an extension to the
C++ standard, and provides compatibility with Microsoft Visual C++. The example
declarations below define dimensionless arrays a and b.
struct S1 { char a[0]; };
struct S2 { char b[]; };
Set nozeroextarray for
compliance with standard C++ or with the ANSI language level supported by
previous versions of VisualAge C++ and predecessor products. |