Forget all critics of highly educated theorists who just say NEVER, NEVER dare to use macros!
Macros are indeed a necessary evil. Yes, sometimes there are other options, such as templates, polymorphism, and other things. But it is not always possible to get rid of repetitions without the use of macros.
And, in my humble opinion, macros are a better alternative than rewriting the same endless time.
. , , .
, ( ).
, , .
, , , 100 , , :
m(i##0) \
m(i##1) \
m(i##2) \
m(i##3) \
m(i##4) \
m(i##5) \
m(i##6) \
m(i##7) \
m(i##8) \
m(i##9)
MACRO_IX10(m, ) \
MACRO_IX10(m, 1) \
MACRO_IX10(m, 2) \
MACRO_IX10(m, 3) \
MACRO_IX10(m, 4) \
MACRO_IX10(m, 5) \
MACRO_IX10(m, 6) \
MACRO_IX10(m, 7) \
MACRO_IX10(m, 8) \
MACRO_IX10(m, 9)
:
MACRO_IX100(MYMACRO)
100 .