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

Re: Doubt in linux/list.h



Libin Varghese wrote:
> Jim Bauer wrote:
> 
>> Libin Varghese wrote:
>>  
>>
>>> Hi,
>>>   In linux/list.h, there is the following lines. Why use a do-while
>>> loop when the statements inside is run only once.
>>>
>>> #define INIT_LIST_HEAD(ptr) do { \
>>>       (ptr)->next = (ptr); (ptr)->prev = (ptr); \
>>> } while (0)
>>>   
>>
>>
>> See http://www.kernelnewbies.org/faq/
>>  
>>
> I understand that it is neccessary for a block of statments, but we are
> they using it for a single statement

Did you miss the ';' in the middle of the line?

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/