还有个有关问题,内联函数的定义必须出现在第一次被调用之前,这句话是否正确
还有个问题,内联函数的定义必须出现在第一次被调用之前,这句话是否正确?
内联函数的定义必须出现在第一次被调用之前,那么如果内联函数的定义出现在第一次被调用之后,是不是说这个内联函数就不是内联函数了呢?比如说:
这个p是不是内联函数?
------解决方案--------------------
晕,这不是 call std::operator<<<std::char_traits<char> >
这是,内联了呀
print() 如果不内联,应该出现
call ?print@@YAXXZ
call _print
call _print@0 之类的代码
内联函数的定义必须出现在第一次被调用之前,那么如果内联函数的定义出现在第一次被调用之后,是不是说这个内联函数就不是内联函数了呢?比如说:
void p();
p();
inline void p(){cout<<"hello";}
这个p是不是内联函数?
------解决方案--------------------
晕,这不是 call std::operator<<<std::char_traits<char> >
这是,内联了呀
print() 如果不内联,应该出现
call ?print@@YAXXZ
call _print
call _print@0 之类的代码
PUBLIC ?print@@YAXXZ ; print
PUBLIC _main
; COMDAT _main
_TEXT SEGMENT
_main PROC NEAR ; COMDAT
; 14 : {
push ebp
mov ebp, esp
sub esp, 64 ; 00000040H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-64]
mov ecx, 16 ; 00000010H
mov eax, -858993460 ; ccccccccH
rep stosd
; 15 : print();
call ?print@@YAXXZ ; print
; 16 : return 0;
xor eax, eax
; 17 : }
pop edi
pop esi
pop ebx
add esp, 64 ; 00000040H
cmp ebp, esp
call __chkesp
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
; COMDAT _main
_TEXT SEGMENT
_main PROC NEAR ; COMDAT
; 14 : {
push esi
push edi
; 15 : print();
push OFFSET FLAT:??_C@_09DNLH@121234245?$AA@ ; `string'
push OFFSET FLAT:?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A ; std::cout
call ??6std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator<<
add esp, 8
mov esi, eax
mov ecx, esi
push 10 ; 0000000aH
call ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z ; std::basic_ostream<char,std::char_traits<char> >::put
mov eax, DWORD PTR [esi]
xor edi, edi
mov ecx, DWORD PTR [eax+4]