From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated C-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.

Moved web-specific content to web template[edit]

The term preprocessor is customarily associated with compilation of source code. (, ( The content related to web application development was moved to web template to avoid the (potentially misleading) implication that a preprocessor is the same thing as a "web template system" that is used for purposes other than web development. Although there are similarities, these concepts are sufficiently distinct to warrant separate treatment in separate articles. Moreover, the similarities go far beyond web application development and thus are more appropriately handled with "See Also" links (e.g., preprocessor similarity to tools like AWK, SED, similarity to Template-based document generation systems, similarity to "mail merge" in word processing software, similarity to perl, similarity to shell-script "Here Documents" ... etc etc). Dreftymac 17:04, 9 October 2006 (UTC)

Final stable resolution: see Preprocessor#General_purpose_preprocessor, and please not delete. -- 17 november 2006.


"Preprocessors are routinely invoked in the process of compiling source code "

There are only a few languages that include a preprocessor. Derek farn 21:46, 9 October 2006 (UTC)
Agreed, this is consistent with my current understanding. The main goal was to preserve the
semantic correlation between 'compiler' and 'preprocessor' as editorial support for the
opening paragraph, and to reinforce the internal consistency of the article. Dreftymac 23:07, 9 October 2006 (UTC)

"Examples of "general purpose" uses include batch processing of HTML or PostScript files, and auto-generation of mailing lists and e-mail "

This raises an interesting question about where to draw the line between a preprocessor and a tool. After all, all text processing could be called preprocessing and a preprocessor is a tool. Derek farn 21:46, 9 October 2006 (UTC)
Agreed again, 100%. In fact, the introduction of 'general purpose processing' (originally presented
as 'Preprocessors as template engines') into this article seemed to detract from the conciseness
and internal consistency of the article. Nonetheless, it did not seem appropriate to remove
this concept entirely, as it does seem to have independent relevance in light of GPP and
M4. These tools seem to have evolved from developers who wanted to do other tasks
that they formerly tried to handle using the C preprocessor, but found it unsatisfactory
which is why they are called 'preprocessors' [citation needed]. The examples given were
gleaned from apparent known uses of M4.
However, to elaborate much futher on such "general purpose" processing I believe detracts from
the article, and the line should be drawn at leaving your last revision as-is. Any further
discussion of this kind of use should either be supported by authoritative reference, or
presented in a different article that directly relates to the type of processing in question.
Dreftymac 23:07, 9 October 2006 (UTC)
I am always happy to agree that my wording is ok :-). I suspect that others will want to tinker, witness the very long discussion and edits over the issue of general-purpose_programming_language. Dreftymac, you don't have to break up lines, the layout engine will do it for you.

Paragraph of specialization[edit]

I'm no expert in Lisp, my paragraph of specialization is not very good. Could anyone improve it ?

I think the problem is that many people use computers arn't computer experts and so wouldn't understand the majority of the jargon on the main article. Also, I'd like to buy a laptop there is no clause stating the different processor speeds and what they are capable of. - The article needs lots of work!

This article is not about microprocessors, but preprocessors (computer programs). Still, I agree it needs lots of work. It has some rather strange statements about slow and inefficient features of the C preprocessor. Ahy1 21:10, 17 August 2006 (UTC)

PHP? I know that the language is run as a sort of "preprocessor" before HTML output, and the name now stands for "PHP: Hypertext Preprocessor", but given the level of programming sophistication it offers, I wouldn't exactly call it a lexical preprocessor. It is a preprocessor of sorts, but it's far more advanced than simple token replacement. (For that matter, so is m4, but that's a bit less clear-cut, I think.)

Also, I've taken the liberty of adding some detail on CPP macros, including their limitations. --Flewellyn 05:39, 22 August 2006 (UTC)

2006-10-10 Purpose and definition of 'preprocessor'[edit]

Preprocessor implements simple macro languages. In a preprocessor/compiler pair, like CPP/C-compiler, the macro language (CPP statements) is embedded on the host language (C code). The use of the preprocessor into this (pair) context is domain-specific. But if we isolate the "macro language" from this pair, it is not so specific, and it can be used for other purposes:

  • If the host language is a other programming language, the macro language enable a higher level of abstraction. Example: using CPP for Javascript preprocessing [1].
  • If the host language is a text or markup text, the macros enable to automatize substitutions and a wide variety of text processing tasks. Example: using M4 (see on-article example) or CPP [2] as a template engine, to HTML generation.

Technically, the preprocessors macro languages express algorithms precisely, and if it can express "all possible algorithms" [3] it can be said "general purpuse". M4 is probably the most well known example of such a general purpose preprocessor. The CPP is sometimes used in a non-C specific role, but not defined as general purpose [4].

-- Krauss 23:17, 10 October 2006 (UTC)

The "General purpose preprocessor" is a not usual concept, but need precision (and to be didactic!) into the explain, to use the correct concepts (and avoid misleading interpretations) in other wiki articles, like template engine. It also need authoritative sources (see reference section), to avoid discussion or premature updates.

There are people who claim that their preprocessors have general purpose use. So the name is appropriate. Derek farn 14:17, 10 October 2006 (UTC)

PLEASE NOT CLEAN OR REDUCE the section without justify here. -- Krauss 10 October 2006

I see that you have cut and pasted material from programming language. Does a general purpose preprocessor have to be Turing complete? I would hope so, but I think the definition is based on general use, not algorithmic completeness. Others might disagree. Derek farn 14:17, 10 October 2006 (UTC)
Krauss Your statement about "Gen. purpose preprocessor" being unusual concept seems correct. Because of this, it would seem a greater emphasis on this concept might give disproportional weight to something that is only slightly relevant to the main subject of this article. It would also seem that, since we all agree we 'need precision', it is enough to acknowledge the concept exists, identify the product(s) that promote the concept, and let it stop there.
Since *any* software that processes text could be called a "preprocessor," misleading implications can be avoided by not mixing technical uses of a term with more 'personalized' uses of the term, based on original research. There's a limit to how much didactic correlation between different articles can be done before things start to get confusing and start sounding like someone's individual soapbox.
Nevertheless, the perspectives you bring to these issues is noteworthy and unique, it's just a matter of keeping that uniqueness comprehensible in the context of the existing usage of terms.Dreftymac 18:37, 10 October 2006 (UTC)


  1. ^ Show how to use C-preprocessor on JavaScript files. "JavaScript is Not Industrial Strength" by T. Snyder.
  2. ^ Show how to use C-preprocessor as template engine. "Using a C preprocessor as an HTML authoring tool" by J. Korpela, 2000.
  3. ^ In mathematical terms, this means the programming language is Turing-complete. MacLennan, Bruce J. (1987). Principles of Programming Languages. Oxford University Press. p. 1. ISBN 0-19-511306-3.  line feed character in |publisher= at position 7 (help)
  4. ^ Proved that the C preprocessor is not Turing-complete, at least not if the template is preprocessed only once. "Best abuse of the C preprocessor" by I. Herrmann.

Merging, need review[edit]

Please see Directive (programming).

Difference in C preprocessing directives?[edit]

This article mentions that there are 2 preprocessing directives for C++: #include <...> and #include"...". Is there a difference between the two? If there is, it should be mentioned in the article.-- (talk) 21:52, 19 December 2008 (UTC)

It's trivia relating to the path in which headers are searched. It should just be removed from the article; it's an implementation detail with no wider consequence. Chris Cunningham (not at work) - talk 11:00, 20 December 2008 (UTC)

About cpp[edit]

I've removed the overattention given to it(it DOES have its own page and there ARE other preprocessors); in addition, I've taken the liberty of taking the semirabid criticism from the article, instead mentioning that the tasks it's used for are accomplished in other ways in other languages(such as Java's preservation of type information prior to linktime to replace header files and agressive inlining to eliminate macros). The lexical section, which no longer dominates the article, should now read much more neutrally. BioTube (talk) 14:33, 15 May 2009 (UTC)


.i redirects to the preprocessor article. What sort of preprocessing related files does the .i file extension designate? --Abdull (talk) 16:05, 10 February 2010 (UTC)

It appears to be associated with C++ as a preprocessor intermediate file; Microsoft Visual Studio .NET seems to use it as well for the same purpose. (From filext) Lokino (talk) 23:40, 2 July 2013 (UTC)