Here is a "simple" method for using the preprocessor to generate code via.
recursion... What do you think of my experimental recursion implementation?
Can you compile it?
Any comments are welcome...
;)
http://appcore.home.comcast.net/appc...meta-recurse.c
P.S. This example supports a max-recursion depth of 5. Of course, the limit
could be hundreds of times larger; whoa, what a big file!
If you want to set a deeper recursion depth you will have to add-on to the
VZPPMETA_DEC and VZPPMETA_RECURSE macros. For instance, if you wanted to
increase the depth from 5 to 6, you would add the following macros:
#define VZPPMETA_DEC_IMPL_I6 5
#define VZPPMETA_DEC_IMPL_D6 7
#define VZPPMETA_DEC_IMPL_N6 0
#define VZPPMETA_RECURSE_IMPL_6(Index, Macro, Param1, Param2) \
Macro(Index, 5, Param1, Param2)
VZPPMETA_RECURSE_IMPL_5(VZPPMETA_INC(Index), Macro, Param1, Param2)
One more thing, I accidentally posted this message to alt.comp.lang.c;
please ignore it.
Sorry!!!!
Thank You