From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-04 08:32:07


"Iain K. Hanson" <iain.hanson_at_[hidden]> wrote

> The preprocessor is NOT a code generator IMHO. It is a textual
> substitution processor. In some ways I regard external tools as more
> honest as they do not pretend to be C++ source code.

I don't know what you definition of "code generator" is, but I think, it's
what allows to generate code based on some minimal input provided. So, if
my user says:

REGISTER(foo, (class)(bool)(TEMPLATE(2)));

And this is expanded into two template specializations for class template
foo, with a class, bool, and template<class, class> class template
parameters, one of them capable of serializing an instantiation of such a
template into a compile-time vector of integral constants, and another one
capable of re-constructing such an instance from this vector, you would not
qualify it as "code generation"?

> IMHO external tools that do text substitution are equivilent to the Cpp
> and do count. If you are after Good ( TM ) code generation tools then I
> would go for graphical case tools that understand the language and type
> system.

Preprocessor has an obvious advantage of availability to everybody. I, for
instance, am very reluctant in downloading/using tools. I suspect many
people are like this, too.

> DRY?

"Don't repeat yourself". Many tasks would require manual code duplication
if not done with Boost PP (which does it for you)

Regards,
Arkadiy