#include?
<
iostream
>
using ? namespace ?std;
int ?function( int ?x, int ?y)
{
???? return ?x + y;
}
void ?main()
{
???? int ?( * p)( int ?x,? int ?y);
???? int ?i;
// ????p?=?(*function);
// ????p?=?function;
????i = ( * function)( 1 ,? 1 );
????i = function( 1 ,? 1 );
}
using ? namespace ?std;
int ?function( int ?x, int ?y)
{
???? return ?x + y;
}
void ?main()
{
???? int ?( * p)( int ?x,? int ?y);
???? int ?i;
// ????p?=?(*function);
// ????p?=?function;
????i = ( * function)( 1 ,? 1 );
????i = function( 1 ,? 1 );
}
(*函數名)?? 以前從未試過這種寫法,做了下測試
1. 地址是一樣的
2. 反匯編的代碼也是一樣的
19:?????? i=(*function)(1, 1);
00401078?? push??????? 1
0040107A?? push??????? 1
0040107C?? call??????? @ILT+0(function) (00401005)
00401081?? add???????? esp,8
00401084?? mov???????? dword ptr [ebp-8],eax
20:
21:?????? i=function(1, 1);
00401087?? push??????? 1
00401089?? push??????? 1
0040108B?? call??????? @ILT+0(function) (00401005)
00401090?? add???????? esp,8
00401093?? mov???????? dword ptr [ebp-8],eax
22:?? }