Search

Thursday, June 18, 2009

This output file is a text file containing each line

This output file is a text file containing each line of
the source file and any include files. Any preproces-
sing directive lines have been removed, along with any
conditional text lines excluded from the compile.
Unless you use a command-line option to specify other-
wise, text lines are prefixed with the file name and
line number of the source or include file the line came
from. Within a text line, any macros are replaced with
their expansion text.
Important! The resulting output of CPP cannot be compiled because
of the file name and line number prefix attached to
each source line.

CPP as a macro =======================================================
preprocessor
The -P option to CPP tells it to prefix each line with
the source file name and line number. If you give it -
P- (turning this option off), CPP omits this line
number information. With this option turned off, CPP
can be used as a macro preprocessor; the resulting .I
file can then be compiled with TC or TCC.

An example =======================================================
The following simple program illustrates how CPP
preprocesses a file, first with -P selected, then with
-P-.
Source file: HELLOAJ.C
#define NAME "H.R. Floyd"
#define BEGIN {
#define END }
main()
BEGIN
printf("%s\n", NAME);
END
Command line used to invoke CPP as a preprocessor:
CPP HELLOAJ.C
Output:
HELLOAJ.c 1:
HELLOAJ.c 2:
HELLOAJ.c 3:

No comments:

Post a Comment