by filereaper · 7y ago · 0 comments
Was curious if it guards against some C pre-processor issues.
/** include/asm-i386/system.h */
#define switch_to(tsk) do {
[...]
} while (0)For details, see http://c-faq.com/cpp/multistmt.html:
if (foo)
MULTI_LINE_MACRO;
Breaks without some wrapper like if (1) { A; B; } or do { A; B; } while (0): if (foo)
A;
B; // oops, unconditional (e.g., "goto fail")