HP aC++/HP C A.06.20 Programmer's Guide
void f(String &s) {
s[0] = ‘0’;
}
Execution Order of Static Constructors in Shared Libraries
In HP C++ (cfront), static constructors in shared libraries listed on the link-line are
executed, by default, in left-to-right order. HP aC++ executes static constructors in
depth-first order; that is, shared libraries on which other files depend are initialized
first. Use the -depth command-line option on the CC command line for enhanced
compatibility with HP aC++.
In addition, HP aC++ reverses the initialization order of .o files on the link-line. To aid
in migration, you can group all .o files together and all .so files together.
Example:
aCC file1.o file2.o lib1.so lib2.so lib3.so
In this scenario, cfront would initialize file2.o first, and then file1.o, while HP
aC++ initializes file1.o and then file2.o. You must take this into account in your
cfront code to avoid link problems with HP aC++.
More Frequent Inlining of Inline Code
HP C++ does not inline some functions even when you request for it. This happens
when the function is too complex. If you use the +w option, the compiler displays a
message whenever it does not inline a requested function.
HP aC++ almost always inlines functions for which you have specified the inline
keyword.
Changes in C++ Syntax
When you migrate from HP C++ to HP aC++, in addition to changes related to standards
based keywords, you may need to make changes to your source code in the following
areas:
• “Explicit int Declaration” (page 276)
• “The for Statement, New Scoping Rules” (page 276)
• “struct as Template Type Parameter is Permitted” (page 277)
• “Base Template Class Reference Syntax Change” (page 277)
• “Tokens after #endif” (page 278)
• “overload not a Keyword” (page 278)
• “Dangling Comma in enum” (page 279)
• “Static Member Definition Required” (page 279)
• “Declaring friend Classes” (page 279)
• “Incorrect Syntax for Calls to operator new” (page 280)
• “Using :: in Class Definitions” (page 280)
Migration Considerations Related to Standardization 275