Preprocessor directive?

As the name implies the PRE processor does processing on source files before it goes to the compiler. The C language has a preprocessor that does various things.

As the name implies the PRE processor does processing on source files before it goes to the compiler. The C language has a preprocessor that does various things. #include - imports and expands a file into the file to be compiled.

#define - macros that are changed into strings in the file that is to be compiled. Wikipedia (I know guys people hate this) has a good overview for the C preprocessor. There is nothing that stops you from using another one such as m4 or writing your own, which would modify or add strings into file based on certain template notation.

A preprocessor is an application which processes something before the main processing. In this context, the preprocessor prepares the source code before the compiler works on it to generate code. The preprocessor handles removing comments, expanding #defines, and #including files, among other thiings.

The main principle behind all it preprocessor tasks, is that the PP knows nothing about the syntax of the programming language. It's just doing mindless text manipulation.

The preprocessors you encounter in languages like C or C++, is basically an automatic text manipulator. It manipulates the source code, so to say. A directive is a command to control that preprocessor.

For instance: #include means stdio. H should be copied in this place in your current file. What's important to note, is that the preprocessor only works on a textual level.It copies or inserts text, or deletes it, but it doesn't do any translation into Assembly, nor does it do any linking or compiling further down the line.

In order not to copy text multiple times over, you'd often see this construct in header files: #ifndef _HEADERFILE_H_ #define _HEADERFILE_H_ /* rest of headerfile... */ #endif This ensures, the headerfile is copied only once into the complete code that is to be compiled after preprocessing (since you may have multiple . C files with #include "headerfile. H" in it.

). All preprocessor directives are prefixed with # when using the preprocessor in gcc for C or C++. Depending on compiler suite and programming language, this may be different, though.

That reminds me, I'd like to have a "generic" preprocessor, one that works on any kind of programming language, would be great for developing new IDEs or when designing your own programming language. Is there something like this already? My Point is, there's no preprocessor for Java, and I sometimes miss the ability to modify the source code automatically when compiling.

– polemon Aug 15 '10 at 14:30 ^^ I agree, I think a lot of work needs to be done in terms of preprocessing technology in terms of getting user scripts into into the compile stages. – Tomas Cokis Aug 15 '10 at 14:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions