Chapter Contents |
Previous |
Next |
Code Generation Conventions |
External identifiers differ from ordinary identifiers in one
important respect: IBM 370 link utilities treat upper- and lowercase letters
as if they were the same. Therefore, when default options are used, the compiler
converts all external identifiers to uppercase. For example, although the
programmer may consider
vermont
and
VERMONT
to be two different functions, the linkage editor does not. If they
are intended to be distinct functions, the compiler
extname
option should be used. (See The extname option.)
External names
are limited by the 370 object code format
to eight characters, and SAS/C translates
underscores (
_
) in external names to pound signs (
#
).
Since the compiler always assumes that external names have the same characteristics
as ordinary identifiers, programmers must be careful not to define external
names that the compiler believes are different but that the linkage editor
interprets as the same name.
You can define external objects with any name that does
not begin with a dollar sign (
$
), two underscores (__)
or an underscore followed by a letter. Certain library functions and data
elements (defined in modules written in C) have names that start with an underscore
(that appears as a pound sign (
#
) in the object code)
or a dollar sign (
$
).
To
circumvent
the above restrictions, the compiler enables you to specify the
extname
option, which permits extended names of up to 64K in length. An extended
name is any name that identifies an
extern
variable or that
identifies an
extern
or
static
function and fits
either of the following criteria:
__asm
or high-level language
(for example,
__pascal
) function.
External Variable Models |
The
compiler uses one of two reference-definition (ref/def) models
for external variables, depending upon whether reentrant modification of external
variables is allowed. The
rent
and
rentext
compiler options
are used as follows to determine whether or not reentrant code is generated:
norent
is specified, reentrant
execution is not allowed and the compiler uses the strict ref/def model.
rent
is specified, reentrant
modification is allowed and the compiler uses the common ref/def model, unless
the
refdef
compiler option is also specified. (The
refdef
option forces the use of the strict ref/def model.)
See
Reentrant and Non-reentrant Identifiers for more information about
rent
and
norent
.
Programming Considerations |
Any program that conforms to the strict ref/def model
also conforms to the common model. However, the reverse is not true. A program
that takes advantage of the common model (for example, by omitting definitions
for some variables) may not compile or link correctly when using the strict
ref/def model. Also, a program that uses the common model and is compiled
with the
rent
or
rentext
option may not
work correctly when compiled with the
norent
option.
You should not link compilations that have been created
with the
rent
and
rentext
options with compilations
that have been created with the
norent
option. External
variables cannot be shared between these two types of compilations, nor will
the resulting load module be reentrant.
Object code produced by the compiler with the
rent
or
rentext
options must be preprocessed by COOL if external
variables are initialized in more than one compilation. Conversely, object
code produced by the compiler with the
norent
option does not
need to be preprocessed by COOL. If you use the
rent
option rather than
the
rentext
option, the initializations of static as
well as external variables affect whether or not the use of COOL is required.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.