Re: 'do {} while (0)' replacement

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

 



> On Wednesday 08 October 2008, Richard Harvey Chapman wrote:
> > #define BREAK_ON_ERROR(i)     \
> >   if (1)                      \
> >   {                           \
> >     if (i < 0)                \
> >       break;                  \
> >   }                           \
> >   else do                     \
> >        {                      \
> >        } while (0)            \

How about

#define BREAK_ON_ERROR(i) if ((i) >= 0) { /* whee! */ } else break

-- 
mailto:jjk@xxxxxxx                 phone:+49-7031-4357-122
  http://www.bawue.de/~jjk/          fax:+49-7031-4357-483
  http://del.icio.us/jjk           As the air to a bird, or the sea to a fish,
                                   so is contempt to the contemptible. [Blake]

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux