C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling and Linking TNS/E Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
17-5
Using Compiler Pragmas IEEE_Float and
Tandem_Float
Using Compiler Pragmas IEEE_Float and Tandem_Float
To use IEEE floating-point format, you can optionally specify the IEEE_FLOAT
pragma on the command line when running the TNS/E native C or C++ compiler.
IEEE_FLOAT is the default setting for TNS/E native compilations.
If you are using TNS/E native C++, you also need to specify the VERSION2 or
VERSION3 directive. For more details, see the pragmas IEEE_FLOAT on
page 13-44, VERSION2 on page 13-108, and VERSION3 on page 13-110.
To use Tandem floating-point format, you must specify the TANDEM_FLOAT
pragma on the command line when running the TNS/E native C or C++ compiler.
TANDEM_FLOAT is the default setting for TNS/R native compilations. See the
pragma TANDEM_FLOAT on page 13-105.
The native compilers set the floating-point format type in the generated object file.
Two examples of compiling native C and C++ programs that use IEEE floating-point
format:
> CCOMP / IN SOURCEA, OUT $.#LIST / OBJECTA; IEEE_FLOAT
> CPPCOMP / IN SOURCEB, OUT $S.#LIST / OBJECTB; VERSION2, &
IEEE_FLOAT
Available for TNS C and C++, FORTRAN,
TAL, pTAL, D-series Pascal, COBOL, and
native C and C++ programs
Available only for native C and C++ programs.
Used internally by TNS/E native COBOL
programs
Requires conversion routines for data
interchange between Tandem format and
IEEE format (see the Guardian Procedure
Calls Reference Manual for more detail
about conversion routines)
Provides easier data interchange with other
systems using 64-bit and 32-bit IEEE floating-
point data formats; interchange typically
consists of reversing the byte order to convert
between big-endian data format (on NonStop
systems) and little-endian format (on the
target system)
Provides better handling of exception
conditions such as overflow and underflow;
the existence of NaN (not a number),
infinities, and exception flags make it easier to
detect invalid results
Tandem Floating-Point Format IEEE Floating-Point Format (continued)