Boost logo

Boost :

Subject: [boost] [preprocessor] automatic recursion curiosity
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-09-14 12:24:29

Hello all,

I have a curiosity about an implementation detail of
Boost.Preprocessor: How does the lib implement Automatic Recursion?

>From the docs under Topic > Reentrancy > Automatic Recursion:

Using automatic recursion to reenter various sets of macros is
obviously much simpler. It completely hides the underlying
implementation details. So, if it is so much easier to use, why do
the state parameters still exist? The reason is simple as well. When
state parameters are used, the state is known at all times. This is
not the case when automatic recursion is used. The automatic
recursion mechanism has to deduce the state at each point that it is
used. This implies a cost in macro complexity that in some
situations--notably at deep macro depths--will slow some preprocessors
to a crawl.

I have not looked at the source code and I'm looking for the glory
details. However, I'd like to understand at a high level how
Boost.Preprocessor is able to implement Automatic Recursion behind the
scene (it just bothers me not being able to imagine how this is
actually done and why it is expensive on some preprocessors). Can
anyone provide a quick explanation or point me to some email thread /
docs that explain that?

Thanks a lot!

Boost list run by bdawes at, gregod at, cpdaniel at, john at