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

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

 



Am Mittwoch 08 Oktober 2008 schrieb Frank Mehnert:
> Hi,
>
> I'm searching for a replacement of
>
>   do {} while (0)
>
> in a macro definition.
>
> My problem is the following:
>
>   #define BREAK_ON_ERROR(i)   \
>     if (1)                    \
>     {                         \
>       if (i < 0)              \
>         break;                \
>     }                         \
>     else do                   \
>     {                         \
>     } while (0)               \
>

What about:

do {
  if (i < 0) {
     break;
  }
} while (0)


Christoph

[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