<s>
The	O
C	B-Language
preprocessor	I-Language
is	O
the	O
macro	B-General_Concept
preprocessor	I-General_Concept
for	O
the	O
C	B-Language
,	O
Objective-C	B-Language
and	O
C++	B-Language
computer	O
programming	O
languages	O
.	O
</s>
<s>
The	O
preprocessor	B-General_Concept
provides	O
the	O
ability	O
for	O
the	O
inclusion	O
of	O
header	B-Language
files	I-Language
,	O
macro	O
expansions	O
,	O
conditional	B-Application
compilation	I-Application
,	O
and	O
line	O
control	O
.	O
</s>
<s>
In	O
many	O
C	B-Language
implementations	O
,	O
it	O
is	O
a	O
separate	O
program	B-Application
invoked	O
by	O
the	O
compiler	B-Language
as	O
the	O
first	O
part	O
of	O
translation	B-Application
.	O
</s>
<s>
The	O
language	O
of	O
preprocessor	B-General_Concept
directives	O
is	O
only	O
weakly	O
related	O
to	O
the	O
grammar	O
of	O
C	B-Language
,	O
and	O
so	O
is	O
sometimes	O
used	O
to	O
process	O
other	O
kinds	O
of	O
text	B-General_Concept
files	I-General_Concept
.	O
</s>
<s>
The	O
preprocessor	B-General_Concept
was	O
introduced	O
to	O
C	B-Language
around	O
1973	O
at	O
the	O
urging	O
of	O
Alan	O
Snyder	O
and	O
also	O
in	O
recognition	O
of	O
the	O
usefulness	O
of	O
the	O
file-inclusion	O
mechanisms	O
available	O
in	O
BCPL	B-Language
and	O
PL/I	B-Language
.	O
</s>
<s>
It	O
was	O
extended	O
shortly	O
after	O
,	O
firstly	O
by	O
Mike	O
Lesk	O
and	O
then	O
by	O
John	O
Reiser	O
,	O
to	O
incorporate	O
macros	O
with	O
arguments	O
and	O
conditional	B-Application
compilation	I-Application
.	O
</s>
<s>
The	O
C	B-Language
preprocessor	I-Language
was	O
part	O
of	O
a	O
long	O
macro-language	O
tradition	O
at	O
Bell	O
Labs	O
,	O
which	O
was	O
started	O
by	O
Douglas	O
Eastwood	O
and	O
Douglas	O
McIlroy	O
in	O
1959	O
.	O
</s>
<s>
Preprocessing	O
is	O
defined	O
by	O
the	O
first	O
four	O
(	O
of	O
eight	O
)	O
phases	O
of	O
translation	B-Application
specified	O
in	O
the	O
C	B-Language
Standard	O
.	O
</s>
<s>
Trigraph	B-Language
replacement	O
:	O
The	O
preprocessor	B-General_Concept
replaces	O
trigraph	B-Language
sequences	I-Language
with	O
the	O
characters	O
they	O
represent	O
.	O
</s>
<s>
Line	O
splicing	O
:	O
Physical	O
source	O
lines	O
that	O
are	O
continued	O
with	O
escaped	B-Algorithm
newline	O
sequences	O
are	O
spliced	O
to	O
form	O
logical	O
lines	O
.	O
</s>
<s>
Tokenization	O
:	O
The	O
preprocessor	B-General_Concept
breaks	O
the	O
result	O
into	O
preprocessing	O
tokens	O
and	O
whitespace	O
.	O
</s>
<s>
Macro	O
expansion	O
and	O
directive	O
handling	O
:	O
Preprocessing	O
directive	O
lines	O
,	O
including	O
file	O
inclusion	O
and	O
conditional	B-Application
compilation	I-Application
,	O
are	O
executed	O
.	O
</s>
<s>
The	O
preprocessor	B-General_Concept
simultaneously	O
expands	O
macros	O
and	O
,	O
since	O
the	O
1999	O
version	O
of	O
the	O
C	B-Language
standard	O
,	O
handles	O
_Pragma	O
operators	O
.	O
</s>
<s>
One	O
of	O
the	O
most	O
common	O
uses	O
of	O
the	O
preprocessor	B-General_Concept
is	O
to	O
include	O
another	O
file	O
:	O
</s>
<s>
The	O
preprocessor	B-General_Concept
replaces	O
the	O
line	O
#include	O
<stdio.h>	O
with	O
the	O
textual	O
content	O
of	O
the	O
file	O
'	O
stdio.h	O
'	O
,	O
which	O
declares	O
the	O
printf( )	O
function	O
among	O
other	O
things	O
.	O
</s>
<s>
If	O
the	O
filename	O
is	O
enclosed	O
within	O
angle	O
brackets	O
,	O
the	O
file	O
is	O
searched	O
for	O
in	O
the	O
standard	O
compiler	B-Language
include	O
paths	O
.	O
</s>
<s>
C	B-Language
compilers	B-Language
and	O
programming	O
environments	O
all	O
have	O
a	O
facility	O
that	O
allows	O
the	O
programmer	O
to	O
define	O
where	O
include	B-Language
files	I-Language
can	O
be	O
found	O
.	O
</s>
<s>
This	O
can	O
be	O
introduced	O
through	O
a	O
command-line	O
flag	O
,	O
which	O
can	O
be	O
parameterized	O
using	O
a	O
makefile	B-Application
,	O
so	O
that	O
a	O
different	O
set	O
of	O
include	B-Language
files	I-Language
can	O
be	O
swapped	O
in	O
for	O
different	O
operating	O
systems	O
,	O
for	O
instance	O
.	O
</s>
<s>
By	O
convention	O
,	O
include	B-Language
files	I-Language
are	O
named	O
with	O
either	O
a	O
.h	B-Language
or	O
.hpp	O
extension	O
.	O
</s>
<s>
Files	O
with	O
a	O
.def	O
extension	O
may	O
denote	O
files	O
designed	O
to	O
be	O
included	O
multiple	O
times	O
,	O
each	O
time	O
expanding	O
the	O
same	O
repetitive	O
content	O
;	O
#include	O
"	O
icon.xbm	O
"	O
is	O
likely	O
to	O
refer	O
to	O
an	O
XBM	B-Device
image	O
file	O
(	O
which	O
is	O
at	O
the	O
same	O
time	O
a	O
C	B-Language
source	O
file	O
)	O
.	O
</s>
<s>
#include	O
often	O
compels	O
the	O
use	O
of	O
#include	O
guards	O
or	O
#pragma	B-Language
once	I-Language
to	O
prevent	O
double	O
inclusion	O
.	O
</s>
<s>
The	O
if-else	O
directives	O
#if	O
,	O
#ifdef	O
,	O
#ifndef	O
,	O
#else	O
,	O
#elif	O
and	O
#endif	O
can	O
be	O
used	O
for	O
conditional	B-Application
compilation	I-Application
.	O
</s>
<s>
Most	O
compilers	B-Language
targeting	O
Microsoft	B-Application
Windows	I-Application
implicitly	O
define	O
_WIN32	O
.	O
</s>
<s>
This	O
allows	O
code	O
,	O
including	O
preprocessor	B-General_Concept
commands	O
,	O
to	O
compile	B-Language
only	O
when	O
targeting	O
Windows	O
systems	O
.	O
</s>
<s>
A	O
few	O
compilers	B-Language
define	O
WIN32	O
instead	O
.	O
</s>
<s>
For	O
such	O
compilers	B-Language
that	O
do	O
not	O
implicitly	O
define	O
the	O
_WIN32	O
macro	O
,	O
it	O
can	O
be	O
specified	O
on	O
the	O
compiler	B-Language
's	O
command	O
line	O
,	O
using	O
-D_WIN32	O
.	O
</s>
<s>
Translation	B-Application
can	O
also	O
be	O
caused	O
to	O
fail	O
by	O
using	O
the	O
#error	O
directive	O
:	O
</s>
<s>
An	O
alternative	O
in	O
both	O
C	B-Language
and	O
C++	B-Language
,	O
especially	O
in	O
situations	O
in	O
which	O
a	O
pointer	O
to	O
the	O
number	O
is	O
required	O
,	O
is	O
to	O
apply	O
the	O
const	O
qualifier	O
to	O
a	O
global	O
variable	O
.	O
</s>
<s>
This	O
causes	O
the	O
value	O
to	O
be	O
stored	O
in	O
memory	O
,	O
instead	O
of	O
being	O
substituted	O
by	O
the	O
preprocessor	B-General_Concept
.	O
</s>
<s>
The	O
macro	O
here	O
is	O
written	O
as	O
all	O
uppercase	O
to	O
emphasize	O
that	O
it	O
is	O
a	O
macro	O
,	O
not	O
a	O
compiled	B-Language
function	O
.	O
</s>
<s>
These	O
include	O
__FILE__	O
and	O
__LINE__	O
,	O
predefined	O
by	O
the	O
preprocessor	B-General_Concept
itself	O
,	O
which	O
expand	O
into	O
the	O
current	O
file	O
and	O
line	O
number	O
.	O
</s>
<s>
generates	O
the	O
printf	B-Language
function	O
:	O
</s>
<s>
Source	O
code	O
debuggers	B-Application
refer	O
also	O
to	O
the	O
source	O
position	O
defined	O
with	O
__FILE__	O
and	O
__LINE__	O
.	O
</s>
<s>
This	O
allows	O
source	O
code	O
debugging	O
when	O
C	B-Language
is	O
used	O
as	O
the	O
target	B-Application
language	I-Application
of	O
a	O
compiler	B-Language
,	O
for	O
a	O
totally	O
different	O
language	O
.	O
</s>
<s>
The	O
first	O
C	B-Language
Standard	O
specified	O
that	O
the	O
macro	O
__STDC__	O
be	O
defined	O
to	O
1	O
if	O
the	O
implementation	O
conforms	O
to	O
the	O
ISO	O
Standard	O
and	O
0	O
otherwise	O
,	O
and	O
the	O
macro	O
__STDC_VERSION__	O
defined	O
as	O
a	O
numeric	O
literal	O
specifying	O
the	O
version	O
of	O
the	O
Standard	O
supported	O
by	O
the	O
implementation	O
.	O
</s>
<s>
Standard	O
C++	B-Language
compilers	B-Language
support	O
the	O
__cplusplus	O
macro	O
.	O
</s>
<s>
Compilers	B-Language
running	O
in	O
non-standard	O
mode	O
must	O
not	O
set	O
these	O
macros	O
or	O
must	O
define	O
others	O
to	O
signal	O
the	O
differences	O
.	O
</s>
<s>
The	O
second	O
edition	O
of	O
the	O
C	B-Language
Standard	O
,	O
C99	B-Language
,	O
added	O
support	O
for	O
__func__	O
,	O
which	O
contains	O
the	O
name	O
of	O
the	O
function	O
definition	O
within	O
which	O
it	O
is	O
contained	O
,	O
but	O
because	O
the	O
preprocessor	B-General_Concept
is	O
agnostic	O
to	O
the	O
grammar	O
of	O
C	B-Language
,	O
this	O
must	O
be	O
done	O
in	O
the	O
compiler	B-Language
itself	O
using	O
a	O
variable	O
local	O
to	O
the	O
function	O
.	O
</s>
<s>
Macros	O
that	O
can	O
take	O
a	O
varying	O
number	O
of	O
arguments	O
(	O
variadic	B-Language
macros	I-Language
)	O
are	O
not	O
allowed	O
in	O
C89	O
,	O
but	O
were	O
introduced	O
by	O
a	O
number	O
of	O
compilers	B-Language
and	O
standardized	O
in	O
C99	B-Language
.	O
</s>
<s>
Variadic	B-Language
macros	I-Language
are	O
particularly	O
useful	O
when	O
writing	O
wrappers	O
to	O
functions	O
taking	O
a	O
variable	O
number	O
of	O
parameters	O
,	O
such	O
as	O
printf	B-Language
,	O
for	O
example	O
when	O
logging	O
warnings	O
and	O
errors	O
.	O
</s>
<s>
One	O
little-known	O
usage	O
pattern	O
of	O
the	O
C	B-Language
preprocessor	I-Language
is	O
known	O
as	O
X-Macros	B-Language
.	O
</s>
<s>
An	O
X-Macro	O
is	O
a	O
header	B-Language
file	I-Language
.	O
</s>
<s>
Commonly	O
these	O
use	O
the	O
extension	O
"	O
.def	O
"	O
instead	O
of	O
the	O
traditional	O
"	O
.h	B-Language
"	O
.	O
</s>
<s>
The	O
include	B-Language
file	I-Language
is	O
then	O
referenced	O
repeatedly	O
.	O
</s>
<s>
Many	O
compilers	B-Language
define	O
additional	O
,	O
non-standard	O
macros	O
,	O
although	O
these	O
are	O
often	O
poorly	O
documented	O
.	O
</s>
<s>
A	O
common	O
reference	O
for	O
these	O
macros	O
is	O
the	O
,	O
which	O
lists	O
"	O
various	O
pre-defined	O
compiler	B-Language
macros	O
that	O
can	O
be	O
used	O
to	O
identify	O
standards	O
,	O
compilers	B-Language
,	O
operating	O
systems	O
,	O
hardware	O
architectures	O
,	O
and	O
even	O
basic	O
run-time	O
libraries	O
at	O
compile-time	O
"	O
.	O
</s>
<s>
The	O
#	O
operator	O
(	O
known	O
as	O
the	O
"	O
Stringification	O
Operator	O
"	O
)	O
converts	O
a	O
token	O
into	O
a	O
C	B-Language
string	B-Language
literal	I-Language
,	O
escaping	O
any	O
quotes	O
or	O
backslashes	O
appropriately	O
.	O
</s>
<s>
You	O
can	O
however	O
write	O
a	O
series	O
of	O
adjacent	O
string	O
constants	O
and	O
stringified	O
arguments	O
:	O
the	O
C	B-Language
compiler	B-Language
will	O
then	O
combine	O
all	O
the	O
adjacent	O
string	O
constants	O
into	O
one	O
long	O
string	O
.	O
</s>
<s>
All	O
C	B-Language
,	O
C++	B-Language
and	O
Objective-C	B-Language
implementations	O
provide	O
a	O
preprocessor	B-General_Concept
,	O
as	O
preprocessing	O
is	O
a	O
required	O
step	O
for	O
those	O
languages	O
,	O
and	O
its	O
behavior	O
is	O
described	O
by	O
official	O
standards	O
for	O
these	O
languages	O
,	O
such	O
as	O
the	O
ISO	O
C	B-Language
standard	O
.	O
</s>
<s>
For	O
instance	O
,	O
the	O
GNU	O
C	B-Language
preprocessor	I-Language
can	O
be	O
made	O
more	O
standards	O
compliant	O
by	O
supplying	O
certain	O
flags	O
.	O
</s>
<s>
The	O
#pragma	O
directive	O
is	O
a	O
compiler-specific	O
directive	O
,	O
which	O
compiler	B-Language
vendors	O
may	O
use	O
for	O
their	O
own	O
purposes	O
.	O
</s>
<s>
A	O
compiler	B-Language
with	O
support	O
for	O
the	O
OpenMP	B-Application
parallelization	O
library	O
can	O
automatically	O
parallelize	O
a	O
for	O
loop	O
with	O
#pragma	O
omp	O
parallel	O
for	O
.	O
</s>
<s>
C99	B-Language
introduced	O
a	O
few	O
standard	O
#pragma	O
directives	O
,	O
taking	O
the	O
form	O
#pragma	O
STDC	O
...	O
,	O
which	O
are	O
used	O
to	O
control	O
the	O
floating-point	O
implementation	O
.	O
</s>
<s>
Many	O
implementations	O
do	O
not	O
support	O
trigraphs	B-Language
or	O
do	O
not	O
replace	O
them	O
by	O
default	O
.	O
</s>
<s>
Many	O
implementations	O
(	O
including	O
,	O
e.g.	O
,	O
the	O
C	B-Language
compilers	B-Language
by	O
GNU	O
,	O
Intel	O
,	O
Microsoft	O
and	O
IBM	O
)	O
provide	O
a	O
non-standard	O
directive	O
to	O
print	O
out	O
a	O
warning	O
message	O
in	O
the	O
output	O
,	O
but	O
not	O
stop	O
the	O
compilation	B-Language
process	O
.	O
</s>
<s>
A	O
typical	O
use	O
is	O
to	O
warn	O
about	O
the	O
usage	O
of	O
some	O
old	O
code	O
,	O
which	O
is	O
now	O
deprecated	B-General_Concept
and	O
only	O
included	O
for	O
compatibility	O
reasons	O
,	O
e.g.	O
</s>
<s>
Some	O
Unix	B-Application
preprocessors	B-General_Concept
traditionally	O
provided	O
"	O
assertions	O
"	O
,	O
which	O
have	O
little	O
similarity	O
to	O
assertions	O
used	O
in	O
programming	O
.	O
</s>
<s>
Objective-C	B-Language
preprocessors	B-General_Concept
have	O
#import	O
,	O
which	O
is	O
like	O
#include	O
but	O
only	O
includes	O
the	O
file	O
once	O
.	O
</s>
<s>
A	O
common	O
vendor	O
pragma	O
with	O
a	O
similar	O
functionality	O
in	O
C	B-Language
is	O
#pragma	B-Language
once	I-Language
.	O
</s>
<s>
As	O
the	O
C	B-Language
preprocessor	I-Language
can	O
be	O
invoked	O
separately	O
from	O
the	O
compiler	B-Language
with	O
which	O
it	O
is	O
supplied	O
,	O
it	O
can	O
be	O
used	O
separately	O
,	O
on	O
different	O
languages	O
.	O
</s>
<s>
Notable	O
examples	O
include	O
its	O
use	O
in	O
the	O
now-deprecated	O
imake	B-Application
system	O
and	O
for	O
preprocessing	O
Fortran	B-Application
.	O
</s>
<s>
However	O
,	O
such	O
use	O
as	O
a	O
general	B-Application
purpose	I-Application
preprocessor	I-Application
is	O
limited	O
:	O
the	O
input	O
language	O
must	O
be	O
sufficiently	O
C-like	O
.	O
</s>
<s>
The	O
GNU	B-Application
Fortran	I-Application
compiler	B-Language
automatically	O
calls	O
"	O
traditional	O
mode	O
"	O
(	O
see	O
below	O
)	O
cpp	O
before	O
compiling	B-Language
Fortran	B-Application
code	O
if	O
certain	O
file	O
extensions	O
are	O
used	O
.	O
</s>
<s>
Intel	O
offers	O
a	O
Fortran	B-Application
preprocessor	B-General_Concept
,	O
fpp	O
,	O
for	O
use	O
with	O
the	O
ifort	B-Language
compiler	B-Language
,	O
which	O
has	O
similar	O
capabilities	O
.	O
</s>
<s>
CPP	O
also	O
works	O
acceptably	O
with	O
most	O
assembly	B-Language
languages	I-Language
and	O
Algol-like	O
languages	O
.	O
</s>
<s>
This	O
requires	O
that	O
the	O
language	O
syntax	O
not	O
conflict	O
with	O
CPP	O
syntax	O
,	O
which	O
means	O
no	O
lines	O
starting	O
with	O
#	O
and	O
that	O
double	O
quotes	O
,	O
which	O
cpp	O
interprets	O
as	O
string	B-Language
literals	I-Language
and	O
thus	O
ignores	O
,	O
do	O
n't	O
have	O
syntactical	O
meaning	O
other	O
than	O
that	O
.	O
</s>
<s>
The	O
"	O
traditional	O
mode	O
"	O
(	O
acting	O
like	O
a	O
pre-ISO	O
C	B-Language
preprocessor	I-Language
)	O
is	O
generally	O
more	O
permissive	O
and	O
better	O
suited	O
for	O
such	O
use	O
.	O
</s>
<s>
The	O
C	B-Language
preprocessor	I-Language
is	O
not	O
Turing-complete	B-Algorithm
,	O
but	O
it	O
comes	O
very	O
close	O
:	O
recursive	O
computations	O
can	O
be	O
specified	O
,	O
but	O
with	O
a	O
fixed	O
upper	O
bound	O
on	O
the	O
amount	O
of	O
recursion	O
performed	O
.	O
</s>
<s>
However	O
,	O
the	O
C	B-Language
preprocessor	I-Language
is	O
not	O
designed	O
to	O
be	O
,	O
nor	O
does	O
it	O
perform	O
well	O
as	O
,	O
a	O
general-purpose	O
programming	O
language	O
.	O
</s>
<s>
As	O
the	O
C	B-Language
preprocessor	I-Language
does	O
not	O
have	O
features	O
of	O
some	O
other	O
preprocessors	B-General_Concept
,	O
such	O
as	O
recursive	O
macros	O
,	O
selective	O
expansion	O
according	O
to	O
quoting	B-Language
,	O
and	O
string	O
evaluation	O
in	O
conditionals	O
,	O
it	O
is	O
very	O
limited	O
in	O
comparison	O
to	O
a	O
more	O
general	O
macro	B-Application
processor	I-Application
such	O
as	O
m4	B-Device
.	O
</s>
