C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-48
INLINE
Usage Guidelines
For the native C++ compiler, the INLINE pragma must be entered on the compiler
RUN command line. For TNS C and c89 in the OSS environment, the pragmas
can be entered on the compiler RUN command line or specified with the
-W[no]inline flag of the c89 utility.
For the TNS/E native compiler, inlining is not performed for optimization level 0.
For TNS C programs, these functions are affected by the INLINE pragma:
strlen(), strcat(), strcmp(), strcpy(), abs(), labs(), memchr(),
memcmp(), memcpy(), and memset().
When compiling with the INLINE pragma, the maximum string limit size for the
strlen(), strcat(), and strcpy() functions is 65,535 bytes. When the
NOINLINE pragma is in effect, the string limit size is 32,767 bytes.
When the INLINE pragma is in effect and a program contains a locally defined
function that has the same name as one of the functions that are affected by the
INLINE pragma, the compiler overrides the locally defined function with the
standard ANSI code. It is necessary to revert to non-inline mode to execute the
locally defined function.
This example, which applies only to TNS C and C++, shows how to mix the inlined
standard definition of strlen and a local version of strlen.
#include <stringh>
size_t strlen(char *p)
{
return -1; /* locally defined, always returns -1 */
}
main()
{
size_t i;
#pragma inline
i = strlen("abc"); /* i == 3 by standard ANSI
specification */
#pragma noinline
i = strlen("abc"); /* i == -1 locally defined */
}