Lets first understand the use of #pragma:
'#pragma' is for compiler directives that are machine-specific or operating-system-specific, i.e. it tells the compiler to do something, set some option, take some action, override some default, etc. that may or may not apply to all machines and operating systems. Implementation vary from one compiler to the next and if some compiler does not support than it comes out without error/warning.
Now coming to second point, it is about the inline behavior -
The following preprocessor directives control function inlining:
#pragma inline (id, ...)
#pragma noinline (id, ...)
Where id is a function identifier:
- If a function is named in a #pragma inline directive, calls to that function are expanded as inline code, if possible.
- If a function is named in a #pragma noinline directive, calls to that function are not expanded as inline code.
- If a function is named in both a #pragma inline and a #pragma noinline directive, an error message is issued.
If a function is to be expanded inline, you must place the function definition in the same module as the function call. The definition can appear either before or after the function call.
The cc command options -O3, -O4, -inline size, -inline speed, or -inline all cause the compiler to attempt to expand calls to functions named in neither a #pragma inline nor a #pragma noinline directive as inline code whenever appropriate, as determined by the following function characteristics:
For optimization level -O2, the C compiler inlines small static routines only.
The #pragma inline directive causes inline expansion regardless of the size or number of times the specified functions are called.