Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
btrask
on Nov 23, 2020
|
parent
|
context
|
favorite
| on:
What is your favorite C programming trick? (2009)
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();
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: