What's the use of do while(0) when we define a macro?

when reading the linux kernel, you will find many macros like this:

#define INIT_LIST_HEAD(ptr) do { /      (ptr)->next = (ptr); (ptr)->prev = (ptr); /  } while (0)  

Why do they use this rather than define it simply in a {}?

 

http://stackoverflow.com/questions/923822/whats-the-use-of-do-while0-when-we-define-a-macro

你可能感兴趣的:(What's the use of do while(0) when we define a macro?)