In many C/C++ macros I\'m seeing the code of the macro wrapped in what seems like a meaningless do while loop. Here are examples.
do while
#define FOO(X
I don't think it was mentioned so consider this
while(i<100) FOO(i++);
would be translated into
while(i<100) do { f(i++); g(i++); } while (0)
notice how i++ is evaluated twice by the macro. This can lead to some interesting errors.
i++