3 ms·
What purpose does the empty do{}while(0); statement serve here?
by raimue 11y ago
What purpose does the empty do{}while(0); statement serve here?
- gp7 11y agoIt puts the whole #define code into a single expression so you can do if (cond) MACRO; and the macro won't expand incorrectly to if (cond) foo; bar; I personally just go the anal retentive route and use brackets everywhere.
- cthrowappp 11y agoNot in this case it doesn't.
- geocar 11y agoNo syntax error if someone writes if(x)defer. Probably better to have a big error message since we can't curry the if. if(x){defer} will be wrong, but it'll be wrong in a different way.