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

Table Of Contents
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
10-1
10
Converting C-Series TNS Programs
to Use the Current TNS Compiler
This section lists the C language-specific changes that you must make to C-series TNS
programs to compile and run them as TNS programs on current systems. Most of
these changes were made to TNS C to make it compliant with the ISO/ANSI
C standard. For a description of Guardian-specific changes, see the Guardian
Application Conversion Guide.
Replace references to the LARGEC, SMALLC, and WIDEC memory-model library
files with the CLARGE, CSMALL, and CWIDE files.
Replace the min and max macros with the _min and _max macros. The behavior
of these macros has not changed.
Make these keyword changes:
°
Replace cc_status with _cc_status.
°
Replace lowmem with _lowmem.
°
Replace extensible with _extensible.
°
Replace variable with _variable.
°
Replace tal with _tal.
The current TNS compiler issues a warning message if it finds an old keyword.
Change code that relies on negative integral values being assigned to errno.
The ISO/ANSI C standard specifies that only positive integral values can be
assigned to errno. To conform to this requirement, changes were made in the
errnoh header file. If your C program source explicitly uses a literal defined in
errnoh, the changes cause the code in the object file to be incompatible with the
run-time library. For example:
if (errno == ERANGE) {...}
compiles into code dependent upon the value denoted by ERANGE. ERANGE has
changed, so you must recompile this program. However, you need not recompile a
program that checks only that the value of errno is 0 or not equal to 0.
Change code that relies on the type of size_t, the result of the sizeof operator.
The type size_t has changed from type long to type unsigned long. This
change applies to the large-memory model (pragma XMEM) and the 32-bit or wide
data model (pragma WIDE).
Change code that uses the result of the sizeof operator for constant operands
under the 32-bit or wide data model (pragma WIDE):
Note. Do not convert a C-series TNS C program to a current native C program directly. First
convert the program from C-series TNS C to current TNS C and then to native C.