H-Series Application Migration Guide (H06.03+)

Native C and C++ Migration Tasks
H-Series Application Migration Guide429855-006
5-7
Native C and C++ Run-Time Library and Tools.h++
Migration Issues
Similarly, the following sequence also has unintended results when used in a TNS/E
compilation:
#ifndef TNS_R_TARGET
printf ("Code intended for TNS");
printf ("Unintentionally compiled for TNS/E");
#endif
In this case, the statement #ifndef TNS_R_TARGET also evaluates to true on a TNS/E
platform. In general, you should avoid using #ifndef for conditional compilation.
A recommended solution is to use the _TANDEM_ARCH macro to distinguish between
platforms for conditional compilation. For example:
#if __TANDEM_ARCH_ =0
printf ("Code intended for TNS");
#endif
#if __TANDEM_ARCH_ =1
printf ("Code intended for TNS/R");
#endif
#if __TANDEM_ARCH_ = 2
printf ("Code intended for TNS/E");
#endif
Native C and C++ Run-Time Library and
Tools.h++ Migration Issues
The TNS/E native C run-time library provides functions conforming to the ISO/ANSI C
Standard. The native C run-time library is nearly identical in the G-series and H-series
RVUs. The main difference is that the H-series library supports new TNS/E C data
types.
The H-series RVUs support two versions of the native C++ run-time library: VERSION2
and VERSION3. VERSION1 is not supported. A C++ program written to use the
VERSION1 library must be updated to use the VERSION2 or VERSION3 library. If you
are currently using the VERSION1 library, you are encouraged to convert to
VERSION3 rather than VERSION2.
VERSION3 of the native C++ run-time library contains functions conforming to the
ISO/ANSI C++ standard. Both VERSION2 and VERSION3 contain functions
conforming to the X/OPEN UNIX 95 specification and HP extensions to these
standards. See the C/C++ Programmer’s Guide for more information on the differences
between the VERSION1, VERSION2, and VERSION3 libraries.
VERSION3 is the default library version for G06.20 and later TNS/R native C++ and for
TNS/E native C++. Prior to G06.20, the default was VERSION1.
The TNS/E native C and C++ run-time libraries support Guardian and OSS processes.
Each library is nearly identical for the Guardian and OSS environments and thus
increases the interoperability between environments.