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

Yep. Been there. Done that.

In the 80's I worked for a guy who insisted that we wrote all our C using macros that made it look like FORTRAN, amongst much other nonsense. How fondly I remember the many hilarious hours spent trying to pin down the cause of unexpected results.

I don't remember any specific examples, but consider:

#define SQ(v) v*v

int sq = SQ(++v);



Classic pitfall with any type of text based pre processor. All variables inside need excessive amount of parenthesis.

In similar vein there is also the “do {} while 0” trick to allow macros to be appear like normal functions and end with semicolon.

Don’t even want to imagine how many more hacks would be needed to transform into another syntax using macros only.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: