Needed explaination:#define xxx do {} while (0)

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

 



Hi all,
Excuse me if this is a very silly question but I was exploring the TCP
code in the kernel and found the following statement. in
"include/net/tcp.h"
       #define TCP_CHECK_TIMER(sk) do { } while (0)
In the function tcp_v4_do_rcv()  the above macro is called a few
times. I could not understand the purpose of that. Aparantly the macro
is doing nothing.
I have also checked the FAQ on kernelnewbies related to the "do { ...
} while (0) " statements, and it says such macros are used to have a
block  of statements without errors on subsitution.  But that only
makes sense if we have some statements inside the do loop.
Can someone help me out here. I must be missing something very obvious.

shourya

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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