Built-in functions

Built-in functions are ones for which the compiler generates inline code at compile time. Every call to a built-in function eliminates a runtime call to the function having the same name in the dynamic library.

Built-in functions are used by application code, while it is running, without reference to the dynamic library. Although built-in functions increase the size of a generated application slightly, this should be offset by the improved performance resulting from reducing the overhead of the dynamic calls. Built-in functions can be used with the System Programming C (SPC) Facilities to generate free-standing C applications.
Restriction: The SPC facility is not supported in AMODE 64.

Table 1 shows all of the built-in functions. In the listing of library functions, each built-in function is labelled as such.

Table 1. Built-in Library Functions
abs() alloca() cds() cs() decabs()
decchk() decfix() fabs() fortrc() memchr()
memcmp() memcpy() memset() strcat() strchr()
strcmp() strcpy() strlen() strncat() strncmp()
strncpy() strrchr() tsched() wmemchr() wmemcmp()
wmemcpy() wmemset()      

The built-in versions of these functions are accessed by preprocessor macros defined in the standard header files. They are not used unless the appropriate header file (such as decimal.h, math.h, stdlib.h, string.h or wchar.h) is included in the source file.

The built-in versions of functions wmemchr(), wmemcmp(), wmemcpy(), and wmemset() are only available under ARCH(7) when LP64 is not used.

Your program will use the built-in version of a standard function only if you include the associated standard header file. However, decfix(), decabs(), and decchk() are implemented only as built-in functions. They are not available without including the header file.

If you are using the standard header file, but want to use the function in the dynamic library instead of the built-in function, you can force a call to the dynamic library by putting parentheses around the function name in your source code: (memcpy)(buf1, buf2, len)

The built-in functions are documented in Using hardware built-in functions in z/OS XL C/C++ Programming Guide.

If you will never use the built-in version, you can also use #undef with the function name. For example, #undef memcpy causes all calls to memcpy in the compilation unit to make a dynamic call to the function rather than using the built-in version.