User's Guide

Obsolete Preprocessor Options
HP aC++ provides support for ANSI/ISO C++ International Standard preprocessing. Since the
standard categorizes support of pre-ISO preprocessing as an anachronism, the ANSI preprocessing
options of HP C++ (cfront) are not supported. For a list of obsolete preprocessor options, see
Table 13: “Obsolete Command-Line Options” (page 200).
Migration Considerations Related to Standardization
The ANSI/ISO C++ International Standard redefines the rules, syntax, and features of C++
language. If your existing code contains any of the standards based keywords as variable names,
you must change the variable names when you convert your program to an HP aC++ program.
In addition to keyword changes, there are changes in C++ Semantics and C++ Syntax.
Changes in C++ Semantics
Following lists the differences in code behavior when you migrate from HP C++ to HP aC++:
Implicit Typing of Character String Literals
Overload Resolution Ambiguity of Subscripting Operator
Execution Order of Static Constructors in Shared Libraries
More Frequent Inlining of Inline Code
NOTE: These differences can occur inspite of compiling your code without errors.
Implicit Typing of Character String Literals
HP C++ implicitly types character string literals as char *. HP aC++, in accordance with the
ANSI/ISO C++ International Standard, types character string literals as const char *. This
difference affects function overloading resolution.
Example:
In the following code, HP aC++ calls the first function a; cfront calls the second.
void a(const char *);
void a(char *);
f() {
a(A_STRING);
}
To prevent existing code from breaking, assign a string literal to a non-const pointer.
Example:
char *p = B_STRING;
NOTE: This feature may not be a part of the Standard in future revisions.
Also, you cannot convert const char * to char *in a conditional expression in this context.
Example:
char *p = f() ? A : B;
In such a scenario, you must change the code.
Example:
const char *p = f() ? A : B;
or
char *p = const_cast(f() ? A : B);
Migration Considerations Related to Standardization 209