<s>
The	O
standard	O
for	O
the	O
C++	B-Language
programming	I-Language
language	I-Language
allows	O
compilers	B-Language
for	O
this	O
language	O
to	O
apply	O
any	O
optimizing	B-Application
transformation	I-Application
to	O
a	O
program	O
during	O
compilation	B-Language
,	O
provided	O
that	O
such	O
optimizations	O
make	O
no	O
change	O
in	O
the	O
"	O
observable	O
behavior	O
"	O
of	O
the	O
program	O
,	O
as	O
specified	O
in	O
the	O
standard	O
;	O
this	O
mostly	O
means	O
that	O
any	O
actions	O
the	O
program	O
performs	O
on	O
its	O
environment	O
occur	O
in	O
the	O
specified	O
order	O
.	O
</s>
<s>
This	O
rule	O
is	O
commonly	O
referred	O
to	O
as	O
the	O
as-if	B-Language
rule	I-Language
.	O
</s>
<s>
The	O
first	O
is	O
that	O
programs	O
exhibiting	O
undefined	B-Language
behavior	I-Language
are	O
exempt	O
;	O
since	O
the	O
observable	O
behavior	O
is	O
not	O
well-defined	O
anyway	O
,	O
any	O
transformation	O
is	O
valid	O
.	O
</s>
<s>
The	O
other	O
two	O
exceptions	O
concern	O
the	O
copying	O
of	O
objects	O
,	O
and	O
are	O
called	O
copy	B-Language
elision	I-Language
and	O
the	O
return	O
value	O
optimization	B-Application
.	O
</s>
<s>
The	O
effect	O
of	O
the	O
as-if	B-Language
rule	I-Language
depends	O
on	O
the	O
specific	O
compiler	B-Language
implementation	O
.	O
</s>
<s>
As	O
an	O
example	O
,	O
in	O
the	O
Microsoft	B-Application
C++	I-Application
compiler	I-Application
,	O
it	O
causes	O
omission	O
of	O
certain	O
optimizations	O
such	O
as	O
instruction	O
reordering	O
around	O
calls	O
to	O
library	B-Library
functions	I-Library
,	O
since	O
such	O
calls	O
may	O
cause	O
input/output	B-General_Concept
actions	O
or	O
accesses	O
to	O
memory	O
locations	O
marked	O
,	O
and	O
changes	O
in	O
the	O
order	O
of	O
those	O
change	O
observable	O
behavior	O
.	O
</s>
<s>
The	O
as-if	B-Language
rule	I-Language
is	O
not	O
specific	O
to	O
C++	B-Language
;	O
many	O
other	O
programming	O
languages	O
,	O
including	O
C	B-Language
,	O
Rust	B-Application
,	O
Go	B-Application
,	O
Ocaml	B-Language
,	O
etc	O
.	O
</s>
<s>
have	O
a	O
similar	O
rule	O
,	O
to	O
permit	O
optimization	B-Application
(	O
notably	O
inlining	O
)	O
.	O
</s>
