On Feb 28, 11:37*pm, Mahesh <mahesh1...@gmail.com> wrote:
> * * * *I need to know if stack frames are generated in case of a
> inline function execution or do they execute just like macros?
The implicit call stack retains all its behaviors as normal regardless
of function call decorations like "inline".
The only thing the standard can say about "inline" is that it prevents
an function's address be stored in a function pointer. For many
cases, this can already be established by the compiler, but this is
useful for compilers that don't. (Its essentially, a new keyword,
helpful for old compilers that will not be updated to the new
standard. Don't ask me; I had no hand in this.)
> * * * if they execute like macros, then what is the need for having
> inline function?
macros just perform text substitutions, and cannot call themselves
recursively.
> where would you use macros and where inlines?
You use macros to avoid call overhead and when text substitution is
sufficient. Macros also have certain compile-time capabilities that
you don't get from function calls: stringification with # x and text
concatenation via: x ## y.
--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/