On Thu, Jan 19, 2006 at 05:48:33PM +0200, Olav Kongas wrote: > Hi, > > The do{SOMETHING}while(0) thingy has been often discussed in > many mailing lists, and recently an entry about it was > updated in kernelnewbies FAQ. > > However, what's the role of do{SOMETHING}while, if that > SOMETHING is empty. In kernel, both forms of defining > 'empty' function-like macros are used: > > #define foo(stuff...) do { } while(0) > > and > > #define foo(stuff...) > > Purely a style difference, or something more there? If just > a style thing, why would anyone prefer a style, which gives > (slightly) more work to compiler? > > Thanks in advance, > Olav > > PS. Please keep me CC-d as I am not subscribed. > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ If you were subscribed to this list, you'd see the following in the footer of each email sent through this list: > FAQ: http://kernelnewbies.org/faq/ The first answer in the FAQ entry for do { ... } while(0) answers your question. cu Adrian -- "Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/