Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line Options

Standards Related Options

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

The compiler accepts the following options related to the ANSI/ISO 9899-1990 Standard for the C Programming Language and ANSI/ISO International Standard and ISO/IEC 14882 Standard for the C++ Programming Language:

-Aa

-Aa

The -Aa option instructs the compiler to use Koenig lookup and strict ANSI for scope rules. This option is equivalent to specifying -Wc,-koenig_lookup,on and -Wc,-ansi_for_scope,on.

The default is off. Refer to -Ae option for aC++ C-mode description. The standard features enabled by -Aa are incompatible with earlier C and C++ features.

-AA

-AA

The -AA option enables the use of the new 2.0 Standard C++ Library, which includes the new standard conforming (templatized) iostream library. This is the first release of the 2.0 library. It conforms to the ISO C++ standard. The default is -AA without -Wc,-ansi_for_scope.

The 2.0 library, a new addition to the HP C++ runtime, is not compatible with the version 1.2.1 Standard C++ Library previously bundled with HP aC++. HP aC++ will continue support for standard C++ library 1.2.1 without name or location change. Customers should not notice any change when -AA is not used. However, the 1.2.1 library is deprecated and will be replaced by the new library eventually.

To use the new 2.0 library, you must consistently use the -AA option to compile and link all translation units. Mixing object files within an executable is not supported.

The version of the 2.0 Standard C++ library (libstd_v2) included in this release is incompatible with the previous versions of the same library. Using the -AA option and the new 2.0 library creates a binary incompatibility with any other applications/libraries compiled with the -AA option under the previous version of the aC++ product.

To use the new 2.0 library, you must recompile using the -AA option.

Usage:

The standard features enabled by -AA are incompatible with the older Rogue Wave Standard C++ Library 1.2.1 and Tools.h++ 7.0.6. All modules must be consistent in using -AA. Mixing modules compiled with -AA with ones that are not is not supported.

The -Wc,-koenig_lookup,on and -Wc,-ansi_for_scope,on options are also set.

NOTE: This option is not supported in legacy HP C. This option is ignored with warnings in aC++ C-mode.

-Aarm

-Aarm

This option enables the Tru64 UNIX C++ Annotated Reference Manual (ARM) dialect. This dialect was the default for Tru64 UNIX C++ compilers through compiler version 5.x. Support of this dialect is intended only to ease porting of existing Tru64 UNIX applications to HP-UX, and not for development of new programs.

For more information on the ARM dialect, refer to the The Annotated C++ Reference Manual, (Margaret A. Ellis and Bjarne Stroustrup, Addison-Wesley, ISBN 0-201-51459-1, 1990).

NOTE: This option is available in HP aC++ compiler version A.06.00 only.

-AC89

-AC89

The -AC89 option invokes the compiler in ANSI C89 compilation mode. This option, when specified with -ext option, invokes a part of ANSI C99 features.

-AC99

-AC99

The -AC99 option invokes the compiler in ANSI C99 compilation mode with its features.

-Ae

-Ae

Setting the -Ae option invokes aC++ as an ANSI C compiler, with additional support for HP C language extensions.

This option is a synonym for -AC89 -ext option.

For C++, if -Ae is anywhere on the command line, C-mode will be in effect. The options, -AA and -AP, are ignored with warnings. If both -Ae and -Aa are present, C-mode will be in effect and the right most option determines whether extended ANSI (-Ae) or strict ANSI (-Aa) is in effect. To get strict ANSI, both -Ae and -Aa option are required.

NOTE: Some code that is a warning in C may be a fatal error in HP aC++.

-Ag++

This option enables GNU C++ dialect compatibility. Not all GNU features are available, for instance, the asm mechanism.

NOTE: This option is available in HP aC++ compiler version A.06.00 only.

-Agcc

This option enables GNU C dialect compatibility. Not all GNU features are available, for instance, the asm mechanism.

NOTE: This option is available in both the HP ANSI C and HP aC++ compilers, version A.06.00 only. For HP aC++, the -Ae option must also be used.

-AOa and -AOe

-AOa

-AOe

See the following C mode options:

In addition to specifying the ANSI C language dialect, allows the optimizer to aggressively exploit the assumption that the source code conforms to the ANSI programming language C standard ISO 9899:1990.

At present, the effect is to make +Otype_safety=ansi the default. As new independently-controllable optimizations are developed that depend on the ANSI C standard, the flags that enable those optimizations may also become the default under -AOa or -AOe.

-AP

-AP

The -AP option turns off -AA mode and uses the older C++ runtime libraries.

NOTE: This option is not supported in legacy HP C. This option is ignored with warnings in aC++ C-mode.

+legacy_cpp

+legacy_cpp

The +legacy_cpp option enables the use of cpp.ansi ANSI C preprocessor. This option is available in aC++ C-mode only.

NOTE: This option is not normally needed and may be deprecated in future.

+legacy_v5

+legacy_v5

This option enables the use of the A.05.60 compiler. The default compiler is the A.06.00 compiler.

+tru64

+tru64

This option causes return types of unprototyped functions to be treated as long, instead of int, matching Tru64 C behavior. This can prevent segfaults in +DD64 mode, resulting from pointer truncation, for instance:

long *a;
long sub() {
   a = malloc(sizeof(long));   /* no prototype! */
   *a = 1234;                  /* segfault if +DD64 and no +tru64 */
   return *a;
}

A preferable solution is to provide the appropriate function prototypes.

NOTE: This option is applicable to C language only.

-Wc,-ansi_for_scope,[on|off]

-Wc,-ansi_for_scope,[on|off]

The -Wc,-ansi_for_scope is option enables or disables the standard scoping rules for init-declarations in for statements; the scope of the declaration then ends with the scope of the loop body. By default, the option is disabled.

Examples:

In the following example, if the option is not enabled (the current default), the scope of k extends to the end of the body of main() and statement (1) is valid (and will return zero). With the option enabled, k is no longer in scope and (1) is an error.

#include <stdio.h>

int main() {
for (int k = 0; k!=100; ++k) {
printf(“%d\n”, k);
}
return 100-k; // (1)
}

In the next example, with the option disabled, the code is illegal, because it redefines k in (2) when a previous definition (1) is considered to have occurred in the same scope.

With the option enabled (-Wc,-ansi_for_scope,on), the definition in (1) is no longer in scope at (2) and thus the definition in (2) is legal.

int main() {
int sum = 0;
for (int k = 0; k!=100; ++k) // (1)
sum += k;
for (int k = 100; k!= 0; ++k) // (2)
sum += k;
}

-Wc,-koenig_loopup,[on|off]

-Wc,-koenig_lookup,[on|off]

The -WC,-koenig_lookup option enables or disables standard argument-dependent lookup rules (also known as Koenig lookup). It causes functions to be looked up in the namespaces and classes associated with the types of the function-call argument. By default, the option is enabled.

Example:

In the following example, if the option is not enabled, the call in main() does not consider declaration (1) and selects (2). With the option enabled, both declarations are seen, and in this case overload resolution will select (1).

namespace N {
   struct S {};
   void f(S const&, int); // (1)
}

void f(N::S const&, long); // (2)

int main() {
   N::S x;
   f(x, 1);
}
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.