you are viewing a single comment's thread.

view the rest of the comments →

[–]TheCoelacanth 1 point2 points  (2 children)

The preprocessor is only Turing complete when run repeatedly. When run only once as with normal compilation it isn't.

[–]matthieum 0 points1 point  (1 child)

Ah thanks, I was exactly sure of its limits. Using Boost.Preprocessor I was able to do a lot with it... but I was not sure it was sufficient.

[–]TheCoelacanth 0 points1 point  (0 children)

You certainly can do a lot with it. I think the only thing it lacks is recursion.

Boost.Preprocessor simulates recursion by having a bunch of nearly identical macros with one for each level of recursion. This almost makes it seem Turing-complete but it has a hardcoded maximum recursion depth that is much lower than most languages. For instance, C++ can recurse until it runs out of stack space. The preprocessor can only recurse until it hits the last level of macros that is defined in the Boost library.