<s>
In	O
the	O
C	B-Language
and	O
C++	B-Language
programming	I-Language
languages	I-Language
,	O
#pragma	O
once	O
is	O
a	O
non-standard	O
but	O
widely	O
supported	O
preprocessor	B-Language
directive	I-Language
designed	O
to	O
cause	O
the	O
current	O
source	O
file	O
to	O
be	O
included	O
only	O
once	O
in	O
a	O
single	O
compilation	O
.	O
</s>
<s>
Thus	O
,	O
#pragma	O
once	O
serves	O
the	O
same	O
purpose	O
as	O
include	B-Language
guards	I-Language
,	O
but	O
with	O
several	O
advantages	O
,	O
including	O
:	O
less	O
code	O
,	O
avoidance	O
of	O
name	O
clashes	O
,	O
and	O
sometimes	O
improvement	O
in	O
compilation	O
speed	O
.	O
</s>
<s>
In	O
this	O
example	O
,	O
the	O
inclusion	O
of	O
grandparent.h	O
in	O
both	O
parent.h	O
and	O
child.c	O
would	O
ordinarily	O
cause	O
a	O
compilation	O
error	O
,	O
because	O
a	O
struct	B-Language
with	O
a	O
given	O
name	O
can	O
only	O
be	O
defined	O
a	O
single	O
time	O
in	O
a	O
given	O
compilation	O
.	O
</s>
<s>
Using	O
#pragma	O
once	O
allows	O
the	O
C	B-Language
preprocessor	I-Language
to	O
include	O
a	O
header	O
file	O
when	O
it	O
is	O
needed	O
and	O
to	O
ignore	O
an	O
#include	O
directive	O
otherwise	O
.	O
</s>
<s>
This	O
has	O
the	O
effect	O
of	O
altering	O
the	O
behavior	O
of	O
the	O
C	B-Language
preprocessor	I-Language
itself	O
,	O
and	O
allows	O
programmers	O
to	O
express	O
file	O
dependencies	O
in	O
a	O
simple	O
fashion	O
,	O
obviating	O
the	O
need	O
for	O
manual	O
management	O
.	O
</s>
<s>
The	O
most	O
common	O
alternative	O
to	O
#pragma	O
once	O
is	O
to	O
use	O
#define	O
to	O
set	O
an	O
#include	B-Language
guard	I-Language
macro	O
,	O
the	O
name	O
of	O
which	O
is	O
picked	O
by	O
the	O
programmer	O
to	O
be	O
unique	O
to	O
that	O
file	O
.	O
</s>
<s>
In	O
the	O
absence	O
of	O
#include	B-Language
guards	I-Language
around	O
#include	O
directives	O
,	O
the	O
use	O
of	O
#pragma	O
once	O
will	O
improve	O
compilation	O
speed	O
for	O
some	O
compilers	O
since	O
it	O
is	O
a	O
higher-level	O
mechanism	O
;	O
the	O
compiler	O
itself	O
can	O
compare	O
filenames	O
or	O
inodes	B-Application
without	O
having	O
to	O
invoke	O
the	O
C	B-Language
preprocessor	I-Language
to	O
scan	O
the	O
header	O
for	O
#ifndef	O
and	O
#endif	O
.	O
</s>
<s>
Yet	O
,	O
since	O
include	B-Language
guards	I-Language
appear	O
very	O
often	O
and	O
the	O
overhead	O
of	O
opening	O
files	O
is	O
significant	O
,	O
it	O
is	O
common	O
for	O
compilers	O
to	O
optimize	O
the	O
handling	O
of	O
include	B-Language
guards	I-Language
,	O
making	O
them	O
as	O
fast	O
as	O
#pragma	O
once	O
.	O
</s>
<s>
Whereas	O
include	B-Language
guards	I-Language
would	O
still	O
protect	O
from	O
double	O
definitions	O
,	O
#pragma	O
once	O
may	O
or	O
may	O
not	O
treat	O
them	O
as	O
the	O
same	O
file	O
in	O
a	O
compiler-dependent	O
way	O
.	O
</s>
<s>
The	O
use	O
of	O
#include	B-Language
guard	I-Language
macros	O
allows	O
dependent	O
code	O
to	O
recognize	O
and	O
respond	O
to	O
slight	O
differences	O
in	O
semantics	O
or	O
interfaces	O
of	O
competing	O
alternatives	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
direct	O
determination	O
for	O
which	O
API	O
is	O
available	O
would	O
make	O
use	O
of	O
the	O
fact	O
that	O
the	O
include	O
file	O
had	O
advertised	O
itself	O
with	O
its	O
#include	B-Language
guard	I-Language
macro	O
.	O
</s>
<s>
The	O
use	O
of	O
#pragma	O
once	O
,	O
like	O
the	O
use	O
of	O
#include	B-Language
guard	I-Language
macros	O
within	O
an	O
include	O
file	O
places	O
the	O
responsibility	O
upon	O
its	O
authors	O
in	O
order	O
to	O
protect	O
against	O
undesired	O
multiple	O
inclusion	O
.	O
</s>
<s>
Over-reliance	O
upon	O
either	O
mechanism	O
on	O
the	O
part	O
of	O
programmers	O
by	O
direct	O
,	O
unprotected	O
use	O
of	O
#include	O
directives	O
without	O
their	O
own	O
#include	B-Language
guard	I-Language
will	O
lead	O
to	O
failure	O
when	O
using	O
an	O
include	O
file	O
that	O
has	O
not	O
protected	O
itself	O
with	O
either	O
mechanism	O
.	O
</s>
<s>
Compiler	O
Support	O
Clang	B-Application
Comeau	B-General_Concept
C/C	I-General_Concept
++	I-General_Concept
Cray	O
C	B-Language
and	O
C++	B-Language
(	O
since	O
9.0	O
)	O
C++Builder	B-Language
XE3	I-Language
Digital	B-Language
Mars	I-Language
C++	I-Language
GNU	B-Application
Compiler	I-Application
Collection	I-Application
(	O
GCC	B-Application
)	O
(	O
officially	O
since	O
3.4	O
)	O
HP	B-Language
C/aC	I-Language
++	I-Language
(	O
since	O
at	O
least	O
A.06.12	O
)	O
IBM	B-Language
XL	I-Language
C/C	I-Language
++	I-Language
(	O
since	O
13.1.1	O
)	O
Intel	B-Language
C++	I-Language
Compiler	I-Language
Microsoft	B-Application
Visual	I-Application
C++	I-Application
(	O
since	O
4.2	O
)	O
NVIDIA	B-Application
CUDA	I-Application
Compiler	I-Application
(	O
depending	O
on	O
the	O
underlying	O
host	O
compiler	O
)	O
Pelles	O
C	B-Language
IDE	O
help/documentation	O
ARM	O
DS-5	O
IAR	O
C/C	O
++	O
Arm	O
Keil	O
Microcontroller	O
Tools	O
:	O
C/C	O
++	O
compilers	O
(	O
e.g.	O
</s>
<s>
KEIL	O
ARMCC	O
5	O
)	O
Oracle	B-Application
Developer	I-Application
Studio	I-Application
C/C	I-Application
++	I-Application
(	O
since	O
12.5	O
)	O
Portland	B-Application
Group	I-Application
C/C	I-Application
++	I-Application
(	O
since	O
at	O
least	O
17.4	O
)	O
TinyCC	B-Language
(	O
since	O
April	O
2015	O
)	O
TASKING	O
VX-toolset	O
for	O
TriCore	O
:	O
C	B-Language
Compiler	O
(	O
since	O
v6.2r2	O
)	O
Texas	O
Instruments	O
Code	O
Generation	O
Tools	O
:	O
C	B-Language
Compiler	O
(	O
e.g.	O
</s>
