By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,655 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,655 IT Pros & Developers. It's quick & easy.

Simple recursive preprocessor meta-program implementation...

P: n/a
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
Jun 14 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.