On Monday 20 December 2004 14:43, Shourya P. Bhattacharya wrote: > 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. Hmmm. That is a bit strange. It indeed does nothing. You often see #define-s like that buy usually they are conditionally compiled like... #ifdef FOO # define foobar() do_something() #else # define foobar() do { } while (0) #endif My best guess is that it is there for a debugging hook. Someone could temporally redefine it while working on that code. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/