From mboxrd@z Thu Jan 1 00:00:00 1970 From: ibaydan@gmail.com (=?ISO-8859-9?Q?=DDsmail_Baydan?=) Date: Wed, 27 Apr 2011 12:09:13 +0300 Subject: What is the adventage of macros against function In-Reply-To: References: Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 2011/4/27 Ramya Desai > 2011/4/27 ?smail Baydan : > > Currently I am trying to learn linux kernel while looking around I saw > that > > a lot of function likes macros are defined.What is the adventage of > macros > > 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. > > Regards, > Ramya. > > > Thanks > > > > -- > > ?smail Baydan > > > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies at kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > thanks -- ?smail Baydan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110427/034f7707/attachment.html