From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Difference between INIT_LIST_HEAD and LIST_HEAD_INIT
Date: Tue, 6 Jan 2015 14:31:21 -0800 [thread overview]
Message-ID: <20150106223121.GA18598@kroah.com> (raw)
In-Reply-To: <CAK7N6vrAPn9j92c_UDA7fMJH0vYYfayzgFGdd-fgtESuMARjag@mail.gmail.com>
On Tue, Jan 06, 2015 at 01:26:45PM -0800, anish singh wrote:
>
>
> On Tue, Jan 6, 2015 at 1:37 AM, nawab <nawablinux@gmail.com> wrote:
>
> hi friends ,
>
> i have a simple doubt when i was looking on linux/list.h
>
> I have seen that? ?INIT_LIST_HEAD and LIST_HEAD_INIT are performing the
> same functionality,the major difference is
> the argument passed.
>
> ?
> yes but that is minor difference. Major is that one is a macro and other is
> a function.
> ?
>
> When we have to use INIT_LIST_HEAD and LIST_HEAD_INIT??
>
>
> When do you use macro and when do you use function?
It depends on your need. Look at how the two are used in the kernel, we
have thousands of examples. Seeing them should explain more than what
we can here.
Or, try it out yourself, write a tiny module using a list and see how
the different functions and macros work.
good luck,
greg k-h
prev parent reply other threads:[~2015-01-06 22:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 9:37 Difference between INIT_LIST_HEAD and LIST_HEAD_INIT nawab
2015-01-06 15:27 ` Valdis.Kletnieks at vt.edu
2015-01-06 16:26 ` Chen Weixiang
2015-01-06 21:26 ` anish singh
2015-01-06 22:31 ` Greg KH [this message]
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=20150106223121.GA18598@kroah.com \
--to=greg@kroah.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.