Sunday, October 4, 2009

Guilty of Code Duplication ?

Here is how macros helps us to reduce code duplication

#define FUNCTION(rw) \
static int fun_##rw##_test() \
{ \
dev_##rw = x \
down_##rw(); \
/* Do something */ \
return 0; \
} \