kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ramya.desai@gmail.com (Ramya Desai)
To: kernelnewbies@lists.kernelnewbies.org
Subject: What is the adventage of macros against function
Date: Wed, 27 Apr 2011 14:16:08 +0530	[thread overview]
Message-ID: <BANLkTimY7UFQy+tEoLmK-bZvU7Uc8cZQtA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTingvD62dCuGLW-4rOrmzMd2uMPwfQ@mail.gmail.com>

2011/4/27 ?smail Baydan <ibaydan@gmail.com>:
> 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
>
>

  reply	other threads:[~2011-04-27  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  8:25 What is the adventage of macros against function İsmail Baydan
2011-04-27  8:46 ` Ramya Desai [this message]
2011-04-27  9:09   ` İsmail Baydan
2011-04-27 12:25   ` Jonathan Neuschäfer
2011-04-27 14:12     ` Ozan Türkyılmaz
2011-04-27  8:57 ` Naveen Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimY7UFQy+tEoLmK-bZvU7Uc8cZQtA@mail.gmail.com \
    --to=ramya.desai@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).