Difference between INIT_LIST_HEAD and LIST_HEAD_INIT

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Tue Jan 6 10:27:05 EST 2015

On Tue, 06 Jan 2015 15:07:17 +0530, nawab said:
> 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.
> When we have to use INIT_LIST_HEAD and LIST_HEAD_INIT??

At the risk of sounding snarky - you use INIT_LIST_HEAD when you have
an argument of the type it takes, and you use LIST_INIT_HEAD when you
have something of the type that *that* one takes.  Just like math.h gives
       double sin(double x);
       float sinf(float x);

so if you have a float, you call sinf() and if you have a double, you
call sin().

(Hint: One looks suspiciously like a data initializer, the other looks
like executable code.... :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150106/109fc439/attachment.bin 

More information about the Kernelnewbies mailing list