3 ms·
do {} while(0) is a common idiom for macros in C, because it consumes the trailing semicolon, which a bare {} block doesn't do. if(x) MACRO(); else som
by btrask 6y ago
do {} while(0) is a common idiom for macros in C, because it consumes the trailing semicolon, which a bare {} block doesn't do.
if(x) MACRO();
else something();
expands to
if(x) { ... }; // Error!
else something();