[mpls-linux-general] coding style of macros
Status: Beta
Brought to you by:
jleu
|
From: nerdboy <ne...@re...> - 2003-02-14 07:19:36
|
here's a macro i came across in the mpls linux code
define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
at the risk of sounding prude,
why is it that the initialization statements were enclosed in braces with a
while(0) ?
couldn't it be simply written as
define INIT_LIST_HEAD(ptr) (ptr)->next = (ptr); (ptr)->prev = (ptr);
or does enclosing it in a one time do-while serve any purpose ?
many many thanks in advance
nerd
|