H-Series Application Migration Guide (H06.07+, J06.03+)
H-Series Application Migration Guide—429855-008
5-1
5
Native C and C++ Migration Tasks
This section describes how to migrate programs written in the G-series TNS/R native
HP C and C++ for NonStop systems languages to an H-series system. Topics in this
section are:
•
Using the TNS/E Native C and C++ Compilers.
•
Possible Source Code Changes on page 5-2.
•
Changed Pragmas and Flags on page 5-5
•
Native C and C++ Run-Time Library and Tools.h++ Migration Issues on page 5-8.
•
Undefined Behavior in C and C++ Programs on page 5-13
•
New H-Series C and C++ Features on page 5-13.
Using the TNS/E Native C and C++ Compilers
Both the TNS/R and TNS/E native C and C++ compilers conform to the ISO/ANSI C
language standard (ISO/IEC 9899:1990 for C, ISO/IEC 14882:1998 for C++). Source
code that compiles without warnings or errors with the TNS/R native C or C++ compiler
will likely compile without warnings or errors using the TNS/E native C or C++ compiler.
The text and number of diagnostic messages produced by the TNS/R and TNS/E
native compilers are nearly identical.
Program logic or behavior that depends on the underlying machine architecture or
uses undocumented features (mainly privileged features) might require changes to
compile and run correctly using the TNS/E native compilers.
The C and C++ compilers can be run in the OSS or Guardian environment. TNS/E
native C and C++ also provide a PC-based cross-compiler that can be run either at the
Windows command prompt, through NSDEE, or through the ETK. In the Guardian
environment. The CCOMP command runs the TNS/E native C compiler and the
CPPCOMP command runs the TNS/E native C++ compiler. In the OSS and PC
environments, the c89 or c99 command runs the native C and C++ compilers.
The H-series version of the c89 command for the PC and the OSS environment
provides a new option to specify the target platform for the compilation: specify
-Wtarget=tns/r to generate RISC code or -Wtarget=tns/r to generate Itanium
code. The default for the PC is -Wtarget=tns/r. The default for OSS is the same as
the host platform. The G-series c89 command does not support this option and can
compile only for TNS/R execution.
The c99 command is available for systems running H06.21 and later H-series RVUs or
J06.10 or later J-series RVUs. The c99 command generates Itanium code, and only
supports the -Wtarget=tns/e or -Wtarget=ipf flags.
Note. The TNS/R code cannot be executed on a TNS/E platform, and TNS/E code cannot be
executed on a TNS/R platform.










