<s>
Single	B-Language
compilation	I-Language
unit	I-Language
(	O
SCU	O
)	O
is	O
a	O
computer	B-General_Concept
programming	I-General_Concept
technique	O
for	O
the	O
C	B-Language
and	O
C++	B-Language
languages	I-Language
,	O
which	O
reduces	O
compilation	B-Language
time	O
for	O
programs	O
spanning	O
multiple	O
files	O
.	O
</s>
<s>
Specifically	O
,	O
it	O
allows	O
the	O
compiler	B-Language
to	O
keep	O
data	O
from	O
shared	O
header	O
files	O
,	O
definitions	O
and	O
templates	B-Application
,	O
so	O
that	O
it	O
need	O
not	O
recreate	O
them	O
for	O
each	O
file	O
.	O
</s>
<s>
It	O
is	O
an	O
instance	O
of	O
program	B-Application
optimization	I-Application
.	O
</s>
<s>
The	O
technique	O
can	O
be	O
applied	O
to	O
an	O
entire	O
program	O
or	O
to	O
some	O
subset	O
of	O
source	O
files	O
;	O
when	O
applied	O
to	O
an	O
entire	O
program	O
,	O
it	O
is	O
also	O
known	O
as	O
a	O
unity	B-Language
build	I-Language
.	O
</s>
<s>
In	O
the	O
C/C	O
++	O
compilation	B-Language
model	O
(	O
formally	O
"	O
translation	O
environment	O
"	O
)	O
,	O
individual	O
/	O
source	O
files	O
are	O
preprocessed	O
into	O
translation	B-Language
units	I-Language
,	O
which	O
are	O
then	O
compiled	B-Language
separately	O
by	O
the	O
compiler	B-Language
into	O
multiple	O
object	O
(	O
or	O
)	O
files	O
.	O
</s>
<s>
These	O
object	O
files	O
can	O
then	O
be	O
linked	B-Application
together	O
to	O
create	O
a	O
single	O
executable	O
file	O
or	O
library	O
.	O
</s>
<s>
However	O
,	O
this	O
leads	O
to	O
multiple	O
passes	O
being	O
performed	O
on	O
common	O
header	O
files	O
,	O
and	O
with	O
C++	B-Language
,	O
multiple	O
template	B-Application
instantiations	O
of	O
the	O
same	O
templates	B-Application
in	O
different	O
translation	B-Language
units	I-Language
.	O
</s>
<s>
The	O
single	B-Language
compilation	I-Language
unit	I-Language
technique	O
uses	O
pre-processor	O
directives	O
to	O
"	O
glue	O
"	O
different	O
translation	B-Language
units	I-Language
together	O
at	O
compile	B-Language
time	O
rather	O
than	O
at	O
link	O
time	O
.	O
</s>
<s>
Therefore	O
,	O
this	O
technique	O
is	O
appropriate	O
for	O
a	O
set	O
of	O
infrequently	O
modified	O
source	O
files	O
with	O
significant	O
overlap	O
(	O
many	O
or	O
expensive	O
common	O
headers	O
or	O
templates	B-Application
)	O
,	O
or	O
source	O
files	O
that	O
frequently	O
require	O
recompilation	O
together	O
,	O
such	O
as	O
due	O
to	O
all	O
including	O
a	O
common	O
header	O
or	O
template	B-Application
that	O
changes	O
frequently	O
.	O
</s>
<s>
Another	O
disadvantage	O
of	O
SCU	O
is	O
that	O
it	O
is	O
serial	O
,	O
compiling	B-Language
all	O
included	O
source	O
files	O
in	O
sequence	O
in	O
one	O
process	O
,	O
and	O
thus	O
cannot	O
be	O
parallelized	O
,	O
as	O
can	O
be	O
done	O
in	O
separate	O
compilation	B-Language
(	O
via	O
distcc	B-Device
or	O
similar	O
programs	O
)	O
.	O
</s>
<s>
Thus	O
SCU	O
requires	O
explicit	O
partitioning	O
(	O
manual	O
partitioning	O
or	O
"	O
sharding	O
"	O
into	O
multiple	O
units	O
)	O
to	O
parallelize	O
compilation	B-Language
.	O
</s>
<s>
SCU	O
also	O
allows	O
an	O
optimizing	B-Application
compiler	I-Application
to	O
perform	O
interprocedural	O
optimization	O
without	O
requiring	O
link-time	B-Application
optimization	O
,	O
therefore	O
allowing	O
optimizations	O
such	O
as	O
inlining	O
,	O
and	O
helps	O
avoiding	O
implicit	O
code	O
bloat	O
due	O
to	O
exceptions	B-General_Concept
,	O
side	O
effects	O
,	O
and	O
register	O
allocation	O
.	O
</s>
<s>
These	O
optimizations	O
are	O
often	O
not	O
possible	O
in	O
many	O
compilers	B-Language
,	O
due	O
to	O
independent	O
compilation	B-Language
,	O
where	O
optimization	O
happens	O
separately	O
in	O
each	O
translation	B-Language
unit	I-Language
during	O
compilation	B-Language
,	O
but	O
the	O
"	O
dumb	O
linker	B-Application
"	O
simply	O
links	O
object	O
files	O
,	O
without	O
performing	O
any	O
optimizations	O
itself	O
,	O
and	O
thus	O
interprocedural	O
optimization	O
between	O
translation	B-Language
units	I-Language
is	O
not	O
possible	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
you	O
have	O
the	O
source	O
files	O
and	O
,	O
they	O
can	O
be	O
placed	O
in	O
a	O
Single	B-Language
Compilation	I-Language
Unit	I-Language
as	O
follows	O
:	O
</s>
<s>
Now	O
the	O
standard	O
header	O
file	O
(	O
)	O
is	O
compiled	B-Language
only	O
once	O
,	O
and	O
function	O
may	O
be	O
inlined	O
into	O
function	O
,	O
despite	O
being	O
from	O
another	O
module	O
.	O
</s>
