Jump to content

Preprocessing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PierreAbbat (talk | contribs) at 13:08, 22 November 2002 (sp). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Preprocessing is the act of processing data before it is parsed. There are numerous situations where it makes sense to do the parsing in several stages. One is where humans are the parsers, and another is in the context of programming.

For instance, in the C programming language, where preprocessor statements are marked with a '#' at the beginning of the line, the preprocessor can implement macros, be used for including external files at different points in the file or to select blocks of code are to be sent to the compiler. The criterias can be several things, such as processor type (e.g. to resolve integer representation problems), availability of function calls (so you can provide an work-around if one is missing) and user preferences.

When preprocessors support macros, calls to macro functions within the code will expand to the whole implementation of the macro before it is sent to the compiler. This can be quite useful where speed is more important than the size of the binary code, and when you need expressions that expand to more than just a function; for instance a case-block.