Simple recursive preprocessor meta-program implementation...

C

Chris Thomasson

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/appcore/src/ppmeta-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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top