3 ms·
The automatic inlining only happens if the inner function is defined in the same file as the outer function, or in a file that is included in it. If the inner f
by TorKlingberg 15y ago
The automatic inlining only happens if the inner function is defined in the same file as the outer function, or in a file that is included in it. If the inner function is called in many places, the normal way in C is to put it in just one C file, and have a declaration of it in a header file that is included where the function is called. Then it will NOT be inlined, unless the linker does link-time inlining, or you do some sort of global compile by concatenating all source files before compiling.
You have to put the whole definition of the inner function in the header file. Also it must be static or inline, otherwise the linker will complain about duplicate functions.