HP aC++/HP C A.06.20 Programmer's Guide
3. Compile and fix syntax errors.
• Note that cfront-generated object code and libraries are not compatible with
those produced by aCC.
• If your program uses operator new, allow for memory allocation exceptions
that may occur. Modify your cfront code to handle memory allocation failures
to avoid a program abort.
4. Make library changes. Begin migration to the Standard C++ Library and Tools.h++
Library.
5. Make template changes.
• If a program or library uses templates, consider source code changes that may
be required to direct template instantiation.
• Use the +inst_directed option with the initial compilation to defer
consideration of compile-time errors due to template instantiation.
Writing Code for both Compilers
Use the __cplusplus macro (defined by the draft standard) to write code that can be
compiled by both HP C++ and HP aC++.
Example:
#if __cplusplus >= 199707L
// HP aC++ code
#else
// HP C++ code
#endif // __cplusplus >= 199707L
Explicit Loading and Unloading of Shared Libraries
HP aC++ uses system calls rather than C++ function calls to explicitly load and unload
shared libraries. When migrating to HP aC++, make the following source code changes:
• Change cxxshl_load() to shl_load().
• Change cxxshl_unload() to shl_unload().
• Change #include <cxxdl.h> to #include <dl.h>.
Memory Allocation
See “Memory Allocation Failure and operator new” (page 265) for more information.
Command-Line Differences
In HP aC++, you invoke the compiler with the aCC command instead of the CC command
used to invoke HP C++.
260 Migrating from HP C++ (cfront) to HP aC++