它们可能是一样的.根据您使用名称的方式,它可以被预处理器替换.例如
//silly but just for demonstration.
int addfive(int n)
{
return n + 5;
}
#define addfive(n) ((n) + 5)
int main(void)
{
int a;
a = addfive(2); //macro
a = (addfive)(2); //function
}
Run Code Online (Sandbox Code Playgroud)
对于前 MS说:http://msdn.microsoft.com/en-us/library/aa272055(v = vs.60).aspx