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 203) 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++.

The following sections describe differences in command-line options:

“New Command-Line Options” (page 199)

“Obsolete Command-Line Options” (page 200)

“Changed Command-Line Options” (page 201)

New Command-Line Options

Table 12 describes the new options for HP aC++. These options are not available for HP C++ (cfront). However, if a related option exists, it is noted here.

See Chapter 2: “Command-Line Options” (page 31) to for a complete list of HP aC++ command-line options.

Table 12 New Command-Line Options

Option

Description

 

 

-g0

Replaces the -gdebugger option. It generates complete debug information for the debugger.

 

 

+help

Invokes the HP aC++ Online Programmer’s Guide.

 

 

+noeh

Disables exception handling. In HP aC++, exception handling is enabled by default.

 

In HP C++ (cfront), exception handling is disabled by default. To enable it, use the +eh option,

 

which is obsolete in HP aC++.

 

 

Command-Line Differences 199