What is the adventage of macros against function
ibaydan at gmail.com
Wed Apr 27 05:09:13 EDT 2011
2011/4/27 Ramya Desai <ramya.desai at gmail.com>
> 2011/4/27 İsmail Baydan <ibaydan at gmail.com>:
> > Currently I am trying to learn linux kernel while looking around I saw
> > a lot of function likes macros are defined.What is the adventage of
> > over functions.
> If the size of the function is very small, then the macro is better
> when compared to function. The macros are replaced at the time of
> preprocessing. However, if there is a function, then there may be
> overhead in calling the function. When there is a call, the return
> address needs to be stored on the stack. This makes some overhead. So,
> if the size of a fucction is big, then define it as function otherwise
> make it as a macro.
> I guess, this helps you a bit.
> > Thanks
> > --
> > İsmail Baydan
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Kernelnewbies