How do I write a recursive for-loop “repeat” macro to generate C code with the CPP preprocessor?

Vesa Karvonen's "Order" library/language can definitely do this for you. It implements unrestricted recursion and looping in the C preprocessor, and as a really cool bonus dresses it up with the nice concise syntax of a "proper" programming language (to clarify: this is not an alternative preprocessor, it just does a lot of token-pasting to keep its keywords short. It is still pure CPP).

With help from the answers here (and studying P99, Chaos, Order, and Cloak) I think I have a reasonably simple and compact proof-of-concept(1). Since I wanted only "repeat" functionality rather than a full blown interpreter, I went with a somewhat different approach than those other solutions. Instead of creating generic "if", "while", or "when" macros, I instead directly used a series of "decrement" macros that expand to the desired macro plus a call to the macro for n-1.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send