TNS/R Native Application Migration Guide
C and C++ Migration Tasks
TNS/R Native Application Migration Guide—523745-001
3-5
Using the Native C and C++ Compilers
Using the Native C and C++ Compilers
Both the TNS and TNS/R native C compilers conform to the ISO/ANSI C language 
standard. Source code that compiles without warnings or errors with the TNS C 
compiler or C++ preprocessor might get warnings or errors using the native C and C++ 
compilers. (In most cases, the native compilers are better than the TNS compilers in 
detecting violations to the ISO/ANSI C standard.) For example, the native C and C++ 
compilers detect the following errors that the TNS compilers do not detect:
•
Characters trailing on a #include line, except nolist.
•
Incorrect use of a NULL pointer. In C, NULL is defined as zero. In TNS programs, 
address 0 exists. If you call a function, such as strlen() with a NULL pointer, the 
function does not trap but returns an answer (typically 1). In native C programs, 
address 0 does not exist. Such function calls will fail, usually with a SIGSEGV. This 
is a user bug that is undetected on the TNS architecture.
It is possible, but highly unlikely, that you will need to make changes caused by 
differences in the translation limits of the TNS and native compilers.
Program logic or behavior that depends on the knowledge of the underlying machine 
architecture or uses undocumented features might require changes to compile and run 
correctly using the native compilers.
There is no correlation between either the text or the number of diagnostic messages 
produced by the TNS and native compilers.
The TNS C compiler and C++ preprocessor support HP extensions to the C and C++ 
languages by default. The native C and C++ compilers do not support HP extensions 
by default. Specify the EXTENSIONS pragma or the -Wextensions c89 flag to direct 
the native compilers to support HP extensions.
In the Guardian environment, the NMC command runs the native C compiler and the 
NMCPLUS command runs the native C++ compiler. In the OSS environment, the 
native c89 utility runs the native C and C++ compilers. See Section 10, Open System 
Services (OSS) API and Utilities Migration Tasks, for c89 migration information.
See the C/C++ Programmer’s Guide for details on compiling and linking native C and 
C++ programs.










