community
directory
books
authors
images
encyclopedia

Email:
Password:
Register

Knowledgerush Search

 

Google
  Web knowledgerush


Search for images of Preprocessor


Message boards   Post comment

Preprocessor

A preprocessor is a program that takes text and performs lexical conversions on it. The conversions may include macro substitution, conditional inclusion, and inclusion of other files.

The C programming language has a preprocessor that performs the following transformations:

  1. Replaces trigraphs with equivalents.
  2. Concatenates source lines.
  3. Replaces comments with whitespace.
  4. Reacts to lines starting with an octothorp (#), performing macro substitution, file inclusion, conditional inclusion, and other transformations.

Overuse of the C preprocessor is considered bad style, especially in C++. Stroustrup introduced features such as templates into C++ in an attempt to make the C preprocessor irrelevant. However, his file inclusion alternative was never seriously considered as it was a poor imitation of the C preprocessor's file inclusion mechanism.

Other preprocessors include m4 and Oracle Pro*C. The m4 preprocessor is general-purpose; Oracle Pro*C converts embedded PL/SQL into C.

Preprocessing can be quite cumbersome in incremental parsing or incremental lexical analysis because changes to preprocessing rules can affect the entire text to be preprocessed.

C Example

A typical example in C is:

#include 

int main (void)
{
    printf("Hello, world!\n");
    return 0;
}
The preprocessor replaces the line #include <stdio.h> with the system header file of that name, which facilitates use of the printf() function.

Referenced By

AspectJ | List of computing topics

 

Compose Your Message

Your Email Address or Pen Name (optional):
Subject:
Your Message:
 

 

 

 

 

 

This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Preprocessor".

 

Contact UsPrivacy Statement & Terms of Use

 
Copyright © 1999-2003 Knowledgerush.com. All rights reserved.