Historically, the term 'builtin' is of course a PL/I one that has been
adopted elsewhere too, e.g., by the HLASM.  In PL/I it refers to
implementation-supplied functions.  Some of
these,  like SQRT and COSH, are always implemented by calls to library
routines;  some of them, like LENGTH and SIGN, are always implemented
in line; and a very few are implemented sometimes in line and
sometimes by a call to a library routine.   ABS is the classical
example of this mixed case.  It is implemented in line, trivially, for
real arithmetic values; but for complex ones, for, say,

declare x complex decimal float(15) ;

it is implemented by a library call.   [The expression abs(a + bi)  is
defined/evaluated as +sqrt(a**2 + b**2) .

Other languages have used different terminologies.  In COBOL, for
example, implementation-supplied functions/routines are called GENERIC
ones.

In C they have usually been called [standard] library functions.    In
PL/I such a declaration as, say,

declare sqrt builtin ;

followed by

x = sqrt(y) ;

forces the compiler or interpreter to use the implementation-supplied
sqrt routine.
If this declaration is omitted an attempt is first made to find and
use another sqrt facility, and only if one is not found is the builtin
facility used.  (The search can be influenced by the presence of a
programmer-supplied generic declaration.)

Historically, compilers have found it easier to reuse values they
generate in line, but they do not always elect to do so for various
reasons.  Values obtained by function calls can in PL/I and some other
languages be characterized explicitly as reducible, in which case
multiple subroutine calls or function references to the same exterrnal
routine that are identical, specify the same unchanged arguments
(actual parameters), can be reduced to a single one.   (This can of
course be highly problematic; the classic nightmare case is that of
reducing calls to a pseudo-random number generator, a sequence-number
generator, or the like.)

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to