Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Useful Porting Tools
Open System Services Porting Guide520573-006
3-2
findcalls Tool
compilers. Refer to the C/C++ Programmer’s Guide for more information on using the
HP C compiler.
The lint tool detects wasteful or error-prone constructions, which in some cases are
actually valid coding practices. By default, lint checks your programs against a
standard library file that contains descriptions of the programs normally loaded when a
C program is run. You have the option of suppressing various checking operations, as
well as generating various types of messages printed by lint.
In addition to these checks, lint checks for the following programming faults:
Defined but unused variables and functions
Variables used before they are set
Functions that return unused values
Flow control: unreachable program portions, unlabeled statements, and
endless loops
Strict type-checking: enumeration, function use, operator selection, and implied
assignments
Nonportable character use, such as incompatible character ranges
The most important messages lint returns involve the matching of the number and
type of formal and actual parameters to functions, the matching of the type of return
expressions and return values of functions, and the use of return values from functions.
A frequent programming error occurs when you fail to declare external functions. The
C programming language operates as if, unless declared, every function returns an
int type. A problem can arise when a function returns a char* type. The lint tool
detects this type-mismatch problem. (In environments where int and char* are the
same size, the ported code will work, but only sometimes. However, this type-
mismatch will cause problems on machines where int is 16 bits and char* is 32
bits.)
findcalls Tool
findcalls is a programming tool developed by HP to help port applications to an
Open System Services (OSS) environment. findcalls is a source code analyzer
written in the Perl programming language. To use findcalls, you must have Perl
installed on a UNIX workstation. findcalls does not run on NonStop systems, and it
is available only through your service provider.
When porting a large UNIX application from one platform to another, determine in
advance which system calls are used by the application. No two implementations of
the UNIX operating system are exactly alike. Even those that conform to open
standards such as IEEE POSIX or X/Open XPG often supply proprietary extensions
beyond the standards. Even if two platforms share 95 percent of the system calls used
by an application, you must deal with the other 5 percent.