C Standard Function Inlining

Pages: 12
Dec 26, 2009 at 7:16pm
But he can write the code in such a way to facilitate the compiler.

1
2
3
4
5
6
7
8
9
10
11
// some header file:
#ifndef FOO_H
#define FOO_H

void general_func( int a, int b, int c );

inline void specialized_func( int a, int b ) {
  general_func( a, b, 4 );
}

#endif 


gives the compiler the best chance to optimize away the function call to
specialized_func in the user's code.
Dec 26, 2009 at 7:35pm
How do I get the assembly code and how do I recognize function calls (I have very basic knowledge of assembly...)

It depends on what compiler you are using.
Dec 27, 2009 at 6:33pm
If it's an option given by the compiler, I'll read its documantation...but I have one last question: how do I recognize a function call in the assembly code (so that I'll be able to tell whether a function has been inlined or not)?
Dec 27, 2009 at 6:55pm
The x86 instruction is CALL.
Topic archived. No new replies allowed.
Pages: 12