Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With your code, placing a semicolon after the macro leads to a compile error. Semicolons are not valid after arbitrary blocks, but it is acceptable to place them after do-while loops.

It's much nicer to be able to call "MYMACRO(1, 2, 3);" than it is to have to remember to leave the semi-colon off.



It compiles fine on GCC. For other compilers, the Wikipedia page I linked offers the caveat:

"This construct is not legal ANSI C; both the typeof keyword, and the construct of placing a compound statement within parentheses, are non-standard extensions implemented in the popular GNU C compiler (GCC)."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: