Re: Difference between INIT_LIST_HEAD and LIST_HEAD_INIT

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

 



On Tue, Jan 06, 2015 at 01:26:45PM -0800, anish singh wrote:
> 
> 
> On Tue, Jan 6, 2015 at 1:37 AM, nawab <nawablinux@xxxxxxxxx> 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

_______________________________________________
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