[preprocessor] Chaos: Auto macros incorrectly deduces the recursion state

Hello, I am not sure if this is the most appropriate place to post this, but I do know the author frequents this mailing list often. Well, when I run this code: #define FIXED(s, n, text) text #define TTP(s, n, id) \ template< \ CHAOS_PP_AUTO_ENUM( \ CHAOS_PP_INC(n), FIXED, class \ ) \ > class id ## n \ /**/ CHAOS_PP_AUTO_ENUM(3, TTP, T) // template<class> class T0, // template<class, class> class T1, // template<class, class, class> class T2 It expands to: template< CHAOS_IP_AUTO_ENUM_1( 1, FIXED, class ) > class T0 , template< CHAOS_IP_AUTO_ENUM_1( 2, FIXED, class ) > class T1 , template< CHAOS_IP_AUTO_ENUM_1( 3, FIXED, class ) > class T2 Showing CHAOS_IP_AUTO_ENUM_1 is incorrect, and its why it won't expand since its trying to be expanded recursively. It should be CHAOS_IP_AUTO_ENUM_2 instead. I'm not sure why it incorrectly deduces the recursion state. TTP is not a deferred expression. Any ideas? Thanks, Paul Fultz II

On 5/8/2012 6:42 AM, paul Fultz wrote:
Showing CHAOS_IP_AUTO_ENUM_1 is incorrect, and its why it won't expand since its trying to be expanded recursively. It should be CHAOS_IP_AUTO_ENUM_2 instead. I'm not sure why it incorrectly deduces the recursion state. TTP is not a deferred expression. Any ideas?
Please e-mail me directly, and I will take a look. FWIW, in comparison to Boost, Chaos generalizes recursion primarily by generalizing an "algorithmic step." Doing so keeps large lists of essentially equivalent macro definitions out of the algorithms. That is one of the reasons why many have seen me write stuff like CHAOS_PP_EXPR(CHAOS_PP_ENUM(...)) many times. However, Chaos also provides (a much smaller number) of entry point thunks (which I rarely use). These *do* require lists (but much smaller lists) of macro definitions per algorithm. These are the CHAOS_PP_AUTO_ macros such as CHAOS_PP_AUTO_ENUM(...) referred to by the Paul Fultz above--which I rarely personally use and apparently broke somehow. So, essentially, you have a large number of algorithmic steps that are generic and reusable, and a small number of entry point thunks. Without looking, I believe the number of entry point thunks is just 16, so you'd have up to 16 levels of nesting (e.g.) CHAOS_PP_AUTO_ENUM which are independent of algorithmic steps. Regards, Paul Mensonides
participants (2)
-
paul Fultz
-
Paul Mensonides