Chapter Contents |
Previous |
Next |
isnotconst isnumconst isstrconst |
Built-in Functions and Macros |
Many of the functions in the library are
implemented as built-in
functions. A built-in function is a function for which the compiler
generates the required machine instructions directly in the compiled code
instead of making a call to a separately compiled routine. True functions are compiled separately and must be linked with the program before
they can be executed. By eliminating the overhead of parameter list creation
and branching, a built-in function is always more efficient than a call to
a true function. Generally, built-in functions can be implemented by a relatively
short sequence of machine instructions. These afford the greatest increase
in efficiency. The
abs
function is a good
example:
#include <math.h> int gt5(register int i){ return (i < -5) ? i + 5 : abs(i); }
Given this C function, the compiler generates a single IBM 370 machine
instruction called Load Positive Register (LPR) to get the absolute value
of
i
. However, calling and executing the
true
abs
function in this example requires
the execution of 20 machine instructions.
The compiler and library implement built-in functions
by defining a macro in the header file that prefixes the string
_ _builtin_
to the function name. For example, the
strcpy
function is declared as follows:
#define strcpy(x, y) _ _builtin_strcpy(x, y)
Following is a list of all SAS/C functions implemented as macros, other than built-in functions:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.