Re: #define ... do { ... } while(0) : a corner case

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

 




On Thu, 19 Jan 2006, Fabiano Ramos wrote:

> On 1/19/06, Olav Kongas <ok@xxxxxxxxxxxxxx> 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?
> >
> 
> Check out
> http://www.kernelnewbies.org/faq/index.php3#dowhile

Ah, sorry, I had overlooked the first item there. 

Learned also about the -Wextra flag. Thanks.

Olav

--
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