C's Limited Macro Capabilities
Bill Poser
poser at csli.Stanford.EDU
Mon Dec 4 13:46:35 AEST 1989
A simple macro processor, like the one we have, is a Good Thing.
I am not so sure that a more powerful macro processor along the
same lines would be. For one thing, the syntax of macro languages
is nasty, and not conducive to good programming practice, and when one
writes complex macros, in effect one is making use of a meta-programming
language. So my gut reaction to proposals for non-trivial extensions to
cpp is generally one of the following, depending on the case at hand:
(a) The problem really calls for make(1);
(b) The problem is better handled by means of preprocessing by
means of an independent language, e.g. AWK or ICON;
(c) The user really should be using a language other than C.
This is isn't to say that one of these is always the solution or that
every extension to cpp is a bad idea, but it does seem to me that complex
macro expansions are fragile, hard to document, and easy to abuse.
More information about the Comp.lang.c
mailing list