Hacker News new | past | comments | ask | show | jobs | submit login

You can implement an acceptable defer with the standard preprocessor and some switch abuse.

The only annoying part is needing to use "defer_return" and such instead of the proper keywords.

Unlike most defer implementations for C this doesn't need a function-scope fixed sized block, it's all properly scoped, the switch effectively models a state machine. Similar tricks can be used to implement yield and such.




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

Search: