Difference between inline function and macro function is same as difference between function and macro.
To get gyst of difference, try the following code.
#define FUN(a) a+a
int fun(int a)
{
return a+a;
}
int main()
{
int a=1;
FUN(a++);
fun(a++);
return 0;
}
In FUN(a++
), a will be incremented as many times as it is being used. In fun(a++)
, it will be incremented once. So, any operation on parameter will be repeated in macro multiple times.
You can debug through inline functions, but not through MACRO.
You can specify the type of parameter in inline function, but not in MACRO.
Using MACRO as function is not recommended. In such cases, do not expect anything good from the debugger.