|
发表于 2005-8-19 18:20:03
|
显示全部楼层
Post by gamedragon
出入栈并不意味着没有被直接嵌在被调用的函数里阿。我看的汇编代码inline的确是被嵌进去了,但是参数仍然是用栈的。
原话我改了
不知道是否让你误解了
你可不可以贴出来你的源代码
和你编译的命令
下面这段选自info gcc
Note that in C and Objective-C, unlike C++, the `inline' keyword does not affect the linkage of the function.
....
When a function is both inline and `static', if all calls to the
function are integrated into the caller, and the function's address is never used, then the function's own assembler code is never referenced. In this case, GCC does not actually output assembler code for the function, unless you specify the option `-fkeep-inline-functions'. Some calls cannot be integrated for various reasons (in particular, calls that precede the function's definition cannot be integrated, and neither can recursive calls within the definition). If there is a non integrated call, then the function is compiled to assembler code as usual. The function must also be compiled as usual if the program
refers to its address, because that can't be inlined.
When an inline function is not `static', th en the compiler must assume that there may be calls from other source files; since a global symbol can be defined only once in any program, the function must not be defined in the other source files, so the calls therein cannot be integrated. Therefore, a non-`static' inline function is always compiled on its own in the usual fashion.
我想你所预见的效果恐怕是static inline的效果吧 |
|