This simple program does not expand the inline functions. After the code there is a listing of masm and source code showing its not inlining. Rather it calling the function doin' the whole epilog then function then prolog rather than expanding the code in place. I've tried without the inline specifier which defaults to inline when defined in the class (which it is).
Generates:Code:#include "stdafx.h" class tstring { long m_nTStringLength; public: inline tstring( int nLength = 100 ) : m_nTStringLength( nLength ) { } inline int GetTString( ) { return m_nTStringLength; } }; int main(int argc, char* argv[]) { tstring t1; long i = t1.GetTString( ); return 0; }
thanksCode:TITLE C:\Practice\tstringTest\tstringTest.cpp PUBLIC ??0tstring@@QAE@H@Z ; tstring::tstring PUBLIC ?GetTString@tstring@@QAEHXZ ; tstring::GetTString PUBLIC _main EXTRN __chkesp:NEAR ; COMDAT _main _TEXT SEGMENT _t1$ = -4 _i$ = -8 _main PROC NEAR ; COMDAT ; 26 : { push ebp mov ebp, esp sub esp, 72 ; 00000048H push ebx push esi push edi lea edi, DWORD PTR [ebp-72] mov ecx, 18 ; 00000012H mov eax, -858993460 ; ccccccccH rep stosd ; 27 : ; 28 : tstring t1; push 100 ; 00000064H lea ecx, DWORD PTR _t1$[ebp] call ??0tstring@@QAE@H@Z ; tstring::tstring ; 29 : ; 30 : long i = t1.GetTString( ); lea ecx, DWORD PTR _t1$[ebp] call ?GetTString@tstring@@QAEHXZ ; tstring::GetTString mov DWORD PTR _i$[ebp], eax ; 31 : ; 32 : return 0; xor eax, eax ; 33 : ; 34 : } pop edi pop esi pop ebx add esp, 72 ; 00000048H cmp ebp, esp call __chkesp mov esp, ebp pop ebp ret 0 _main ENDP _TEXT ENDS ; COMDAT ??0tstring@@QAE@H@Z _TEXT SEGMENT _nLength$ = 8 _this$ = -4 ??0tstring@@QAE@H@Z PROC NEAR ; tstring::tstring, COMDAT ; 17 : { } push ebp mov ebp, esp sub esp, 68 ; 00000044H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-68] mov ecx, 17 ; 00000011H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx mov eax, DWORD PTR _this$[ebp] mov ecx, DWORD PTR _nLength$[ebp] mov DWORD PTR [eax], ecx mov eax, DWORD PTR _this$[ebp] pop edi pop esi pop ebx mov esp, ebp pop ebp ret 4 ??0tstring@@QAE@H@Z ENDP ; tstring::tstring _TEXT ENDS ; COMDAT ?GetTString@tstring@@QAEHXZ _TEXT SEGMENT _this$ = -4 ?GetTString@tstring@@QAEHXZ PROC NEAR ; tstring::GetTString, COMDAT ; 20 : { push ebp mov ebp, esp sub esp, 68 ; 00000044H push ebx push esi push edi push ecx lea edi, DWORD PTR [ebp-68] mov ecx, 17 ; 00000011H mov eax, -858993460 ; ccccccccH rep stosd pop ecx mov DWORD PTR _this$[ebp], ecx ; 21 : return m_nTStringLength; mov eax, DWORD PTR _this$[ebp] mov eax, DWORD PTR [eax] ; 22 : } pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0 ?GetTString@tstring@@QAEHXZ ENDP ; tstring::GetTString _TEXT ENDS END
dang



LinkBack URL
About LinkBacks


