C/C++ Programmer's Guide (G06.25+)
Introduction to HP C and C++ for NonStop Systems
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
1-22
Porting Without Data Alignment Problems
•
Redesign the code to use functions and features of ISO/ANSI C.
Many UNIX compilers now comply with the ISO/ANSI C standard. Unlike the HP C
compilers, most of these compilers do not strictly enforce the standard by default.
These compilers allow features that do not comply with the standard but that the
compilers can still process correctly. Thus, many programs that you thought to be
compliant are not.
To compile standard-compliant programs with the native C compiler, specify the
pragma KR (for Kernighan & Ritchie or Common-Usage C). To compile such programs
with the TNS C compiler, first convert the programs to ISO/ANSI C in their original
environment. The documentation for these compilers often describes the specific
changes required to make a program comply with ISO/ANSI C.
The following commercially available texts describe writing programs that comply with
the ISO/ANSI C standard and porting from Common-Usage C to ISO/ANSI C:
•
Harbison, Samuel P. and Guy L. Steele. C, A Reference Manual. Prentice Hall,
Inc., 1991.
•
Kernighan, Brian W. and Dennis M. Ritchie. The C Programming Language.
Prentice Hall, Inc., 1988.
•
Strake, David. C Style: Standards and Guidelines. Prentice Hall, Inc., 1992.
•
ANSI C Transition Guide. Prentice Hall, Inc., 1990.
Porting Without Data Alignment Problems
Section 8, Mixed-Language Programming for TNS/R and TNS/E Native Programs, and
Section 23, Handling TNS Data Alignment, provide guidance on the use of compiler
pragmas to avoid data alignment problems when sharing data between programs in
different compiler languages or when porting programs and data between HP
development environments or between NonStop platforms.
You can also use the Data Definition Language (DDL) to define data structures in a
manner that minimizes data alignment problems. DDL can be used to describe
Enscribe data file structures or to generate source code with data-object filler
appropriate for various compiler data alignment pragmas. See the Data Definition
Language (DDL) Reference Manual for more information.
Guardian and OSS Environment
Interoperability
Open System Services (OSS) is an alternative to the Guardian interface through which
users and programs can interact with the NonStop operating system. The main
purpose of Open System Services is to provide an open interface to the operating
system for supporting portable applications.