Re: Difference between INIT_LIST_HEAD and LIST_HEAD_INIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.... :)

Attachment: pgpucztK1msy2.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux