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

I've seen 'C' macros used to do template-ey things that probably reinforced the readability of the code ( once you get used to the fact that the macros were there at all ) .

More modern compilers allow using non-static "const" constructs to do much of the same, which is a great improvement.

To wit:

#define in_bounds(lower,x,upper) ((x <upper) && (x >lower))

vs. const bool in_bounds = ((x > lower) && ( x < upper ));

Macros can be used effectively for reduction in strength, so long as you're not too clever about it.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: