Guardian Application Conversion Guide
Recompiling Your C Program
Converting C Applications
096047 Tandem Computers Incorporated 5–5
Using Type long in Bit-field
Declarations
Programs should only use the type int in bit-field declarations. ANSI C only supports
type int for bit field declarations. However, the D-series compiler continues to support
bit field declarations of type short for large-memory model and type long for wide-
data model. To continue to use type long in bit-field declarations under the wide-data
model, you must specify a FIELDALIGN SHARED2 pragma for the module that
contains the declarations. The pragma can be specified either in the compiler
command line or at the beginning of the source file before any other text except
comments.
Using the New Definition
for errno
The C-series compiler defines errno as a variable with negative values. The D-series
compiler defines errno as a macro with positive values. You might need to recompile
your program using the new errno definitions in the errnoh header file. You must
modify and recompile your program if:
It explicitly examines errno values or performs a general check for negative
errno values.
It uses literal values for errno that have changed.
It declares errno as:
extern int errno
Replace this declaration with:
#include <errno.h>
It has the potential to export errno values to another process that expects to
receive the old values (you can remap the new values to the old values).
Result of the sizeof
Operator
Under the wide-data model, the sizeof operator returns a different value for
constant operands. On C-series systems, sizeof returns 2 or 4. On D-series systems,
sizeof always returns 4. This change was made for ANSI compliance. You must
change programs that rely on the sizeof operator returning a 2 for constant
operands.
Type of size_t size_t, the result of the sizeof operator, has changed from type long to type
unsigned long for programs that use the large-memory model or the wide-data model.
You must change programs that rely on size_t being of type long.
fflush Function On C-series systems, the fflush function can flush partial lines to stdout (standard
output) or stderr (standard error) file if the file is redirected to type 101 edit files. On
D-series systems, the fflush function cannot flush partial lines to stdout and
stderr because these files are shared resources under the Common Run-Time
Environment, the CRE.
If your program must flush partial lines to stdout or stderr, you can either open
the file using the freopen function or close and reopen the file using the fopen
function. In both cases, the file cannot be shared.