S
subramanian100in
Suppose I am using a compiler which is C99 compliant.
Function-like macros have the disadvantage if an argument with side-
effects is passed.
For example,
#define SQUARE(x) ( (x) * (x) )
If SQUARE(x++) is called, it results in undefined behaviour.
Instead we can use the C99 feature of inline function. Am I correct ?
Given this, is there any reason for still preferring function-like
macros over inline function feature of C99 ?
Function-like macros have the disadvantage if an argument with side-
effects is passed.
For example,
#define SQUARE(x) ( (x) * (x) )
If SQUARE(x++) is called, it results in undefined behaviour.
Instead we can use the C99 feature of inline function. Am I correct ?
Given this, is there any reason for still preferring function-like
macros over inline function feature of C99 ?