Using built-in functions to improve performance
A built-in function is inline code that is generated in place of an actual function call.
The built-in functions described in this topic behave exactly the same as those in the C library. The compiler will generate inline code for these functions if the appropriate header file is included in the source. For more information, see Built-in functions in z/OS XL C/C++ Runtime Library Reference.
If you have included the header files but you want to call either the library version of the function or your own version, enclose the function name in parentheses when you make the call. For example, if you wanted to call only memcpy from the header file and use the built-in functions for other memory-related functions, code the function call as follows:
(memcpy)(buf1, buf2, len)
Built-In Function | Header File |
---|---|
abs() | stdlib.h |
alloca() | stdlib.h |
ceil() | math.h |
ceilf() | math.h |
ceill() | math.h |
Note: The compiler only attempts
to generate inline code for ceil(), ceilf(),
and ceill() when the OPTIMIZE(2) compiler
option is used.
|
|
decabs() | decimal.h |
decchk() | decimal.h |
decfix() | decimal.h |
fabs() | math.h |
Note: The compiler only attempts
to generate inline code for fabs() when
the OPTIMIZE(2) compiler option is used.
|
|
floor() | math.h |
floorf() | math.h |
floorl() | math.h |
Note: The compiler only attempts
to generate inline code for floor(), floorf(),
and floorl() when the OPTIMIZE(2) compiler
option is used.
|
|
fortrc() | stdlib.h |
memchr() | string.h |
memcpy() | string.h |
memcmp() | string.h |
memset() | string.h |
strcat() | string.h |
strchr() | string.h |
strcmp() | string.h |
strcpy() | string.h |
strlen() | string.h |
strncat() | string.h |
strncmp() | string.h |
strncpy() | string.h |
strrchr() | string.h |
wmemchr() | wchar.h |
wmemcmp() | wchar.h |
wmemcpy() | wchar.h |
wmemset() | wchar.h |
Note: The compiler
only attempts to generate inline code for wmemchr(), wmemcmp(), wmemcpy(),
and wmemset() when the ARCH(7) compiler option is
used. LP64 compiles will not generate inline code.
|