Re: why do we use while (0)

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

 



sahlot arvind wrote:
> Yes I get an error in this code -
> ---------------------------------
> struct list_head {
>     struct list_head *next, *prev;
> };
> 
> #define INIT_LIST_HEAD(ptr)    {(ptr)->next = (ptr); (ptr)->prev = (ptr);}
> 
> int main ()
> {
>     int i;
>     struct list_head mylist;
>     struct list_head *ptr = &mylist;
>     printf ("hi\n");
>     if (i)
>         INIT_LIST_HEAD(ptr);
>     else
>     {
>         printf ("jkldkas\n");
>     }
>     return 0;
> }
> --------------------------
> 
> 
> Got the reason why while (0) is there.
> Thanks man!
> - Arvind
> 

Yes, you got it! :)

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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