我一直在用C++测试内联函数调用.
Thread model: win32
gcc version 4.3.3 (4.3.3-tdm-1 mingw32)
Run Code Online (Sandbox Code Playgroud)
C++编程语言中的Stroustrup:
内联说明符是编译器的一个提示,它应该尝试生成代码内联,而不是为函数设置一次代码,然后通过通常的函数调用机制调用.
但是,我发现生成的代码根本不是内联的.有一个CALL为instrction 国际广场的功能.
替代文字http://i42.tinypic.com/8ys3f4.jpg
为什么会这样?那我怎么能使用内联函数呢?
编辑:使用的命令行选项:
**** Build of configuration Debug for project InlineCpp ****
**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\InlineCpp.o ..\src\InlineCpp.cpp
g++ -oInlineCpp.exe src\InlineCpp.o
Run Code Online (Sandbox Code Playgroud)