macro Vs inline
The C/C++ style, macros without arguments should look like variable or other identifiers, macros with arguments should look like function calls.
so any difference between macro and inline?
#define SQUARE(x) ((x)*(x))
inline int square(int x) {return x*x;}
macro may not work properly if the actually argument is an expression with side efforts, for example:
SQUARE(i++)
The inline is newly added to C standard from C99, the previous C compiler might not support it
inline checks type of argument and does conversion, it might not work properly sometimes.for example:
double f = square(1.5);
and in C++, we can use template for avoid this issue, like
inline const _T square_t(_T x) {return x*x;}