'do {} while (0)' replacement
Jens Kilian
jens.kilian@verigy.com
Fri Oct 10 11:50:00 GMT 2008
> 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@acm.org 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]
More information about the Gcc-help
mailing list