Thread (2 messages) 2 messages, 2 authors, 2015-01-06

Difference between INIT_LIST_HEAD and LIST_HEAD_INIT

From: Valdis.Kletnieks at vt.edu <hidden>
Date: 2015-01-06 15:27:05

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
us:
       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 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help