<s>
Managed	B-Language
Extensions	I-Language
for	I-Language
C++	I-Language
or	O
Managed	B-Language
C++	I-Language
is	O
a	O
now-deprecated	O
set	O
of	O
language	O
extensions	O
for	O
C++	B-Language
,	O
including	O
grammatical	O
and	O
syntactic	O
extensions	O
,	O
keywords	O
and	O
attributes	O
,	O
to	O
bring	O
the	O
C++	B-Language
syntax	O
and	O
language	O
to	O
the	O
.NET	B-Application
Framework	I-Application
.	O
</s>
<s>
These	O
extensions	O
were	O
created	O
by	O
Microsoft	O
to	O
allow	O
C++	B-Language
code	I-Language
to	O
be	O
targeted	O
to	O
the	O
Common	O
Language	O
Runtime	O
(	O
CLR	O
)	O
in	O
the	O
form	O
of	O
managed	O
code	O
,	O
as	O
well	O
as	O
continue	O
to	O
interoperate	O
with	O
native	B-Language
code	O
.	O
</s>
<s>
In	O
2004	O
,	O
the	O
Managed	B-Language
C++	I-Language
extensions	O
were	O
significantly	O
revised	O
to	O
clarify	O
and	O
simplify	O
syntax	O
and	O
expand	O
functionality	O
to	O
include	O
managed	O
generics	B-Language
.	O
</s>
<s>
These	O
new	O
extensions	O
were	O
designated	O
C++	B-Language
/CLI	I-Language
and	O
included	O
in	O
Microsoft	B-Application
Visual	I-Application
Studio	I-Application
2005	I-Application
.	O
</s>
<s>
The	O
term	O
Managed	B-Language
C++	I-Language
and	O
the	O
extensions	O
it	O
refers	O
to	O
are	O
thus	O
deprecated	O
and	O
superseded	O
by	O
the	O
new	O
extensions	O
.	O
</s>
<s>
Microsoft	O
introduced	O
Managed	B-Language
Extensions	I-Language
for	I-Language
C++	I-Language
in	O
Microsoft	B-Application
Visual	I-Application
C++	I-Application
2002	O
(	O
MSVC++	O
)	O
.	O
</s>
<s>
Microsoft	O
attempted	O
to	O
minimise	O
the	O
deviations	O
between	O
standard	O
C++	B-Language
and	O
Managed	B-Language
Extensions	I-Language
for	I-Language
C++	I-Language
,	O
resulting	O
in	O
core	O
differences	O
between	O
the	O
two	O
being	O
syntactically	O
obscured	O
.	O
</s>
<s>
MSVC++	O
2003	O
and	O
2005	O
also	O
provided	O
support	O
for	O
writing	O
programs	O
in	O
Managed	B-Language
C++	I-Language
.	O
</s>
<s>
In	O
2004	O
,	O
Managed	B-Language
Extensions	I-Language
for	I-Language
C++	I-Language
was	O
deprecated	O
in	O
favor	O
of	O
C++	B-Language
/CLI	I-Language
,	O
a	O
second	O
attempt	O
by	O
Microsoft	O
at	O
supporting	O
programming	O
for	O
the	O
Common	O
Language	O
Infrastructure	O
using	O
C++	B-Language
.	O
</s>
<s>
Managed	O
refers	O
to	O
managed	O
code	O
that	O
it	O
is	O
run	O
in	O
,	O
or	O
managed	O
by	O
,	O
the	O
.NET	B-Application
virtual	B-Architecture
machine	I-Architecture
that	O
functions	O
as	O
a	O
sandbox	O
for	O
enhanced	O
security	O
in	O
the	O
form	O
of	O
more	O
runtime	O
checks	O
,	O
such	O
as	O
buffer	B-General_Concept
overrun	I-General_Concept
checks	O
.	O
</s>
<s>
Additionally	O
,	O
applications	O
written	O
in	O
Managed	B-Language
C++	I-Language
compile	O
to	O
CIL	O
—	O
Common	O
Intermediate	O
Language	O
—	O
and	O
not	O
directly	O
to	O
native	B-Language
CPU	B-General_Concept
instructions	O
like	O
standard	O
C++	B-Language
applications	O
do	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
code	O
could	O
inter-operate	O
with	O
any	O
other	O
language	O
also	O
targeted	O
for	O
the	O
CLR	O
such	O
as	O
C#	B-Application
and	O
Visual	B-Language
Basic	I-Language
.NET	I-Language
as	O
well	O
as	O
make	O
use	O
of	O
features	O
provided	O
by	O
the	O
CLR	O
such	O
as	O
garbage	B-General_Concept
collection	I-General_Concept
.	O
</s>
<s>
This	O
means	O
Managed	B-Language
C++	I-Language
occupies	O
a	O
unique	O
position	O
in	O
the	O
gallery	O
of	O
.NET	B-Application
languages	O
.	O
</s>
<s>
It	O
is	O
the	O
only	O
language	O
that	O
can	O
communicate	O
directly	O
with	O
.NET	B-Application
languages	O
(	O
such	O
as	O
C#	B-Application
,	O
VB.NET	B-Language
)	O
as	O
well	O
as	O
native	B-Language
C++	B-Language
.	O
</s>
<s>
The	O
other	O
.NET	B-Application
languages	O
can	O
only	O
communicate	O
with	O
C++	B-Language
code	I-Language
via	O
PInvoke	O
or	O
COM	B-Application
.	O
</s>
<s>
But	O
since	O
Managed	B-Language
C++	I-Language
can	O
communicate	O
directly	O
in	O
both	O
managed	O
and	O
standard	O
C++	B-Language
contexts	O
,	O
it	O
is	O
often	O
used	O
as	O
a	O
"	O
bridge	O
"	O
.	O
</s>
<s>
Programs	O
coded	O
in	O
Managed	B-Language
C++	I-Language
provide	O
additional	O
functionality	O
of	O
the	O
.NET	B-Application
Framework	I-Application
and	O
the	O
CLR	O
.	O
</s>
<s>
Most	O
notable	O
of	O
these	O
is	O
garbage	B-General_Concept
collection	I-General_Concept
,	O
which	O
relieves	O
the	O
programmer	O
of	O
manual	O
memory	O
management	O
.	O
</s>
<s>
The	O
garbage	B-General_Concept
collector	I-General_Concept
(	O
GC	O
)	O
is	O
handled	O
by	O
the	O
CLR	O
.	O
</s>
<s>
Memory	O
management	O
is	O
executed	O
quite	O
quickly	O
,	O
but	O
for	O
more	O
performance	O
critical	O
applications	O
,	O
native	B-Language
,	O
unmanaged	O
code	O
is	O
most	O
likely	O
the	O
preferred	O
option	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
is	O
geared	O
towards	O
object-oriented	O
programming	O
.	O
</s>
<s>
A	O
major	O
difference	O
between	O
standard	O
C++	B-Language
and	O
Managed	B-Language
C++	I-Language
is	O
that	O
multiple	B-Application
inheritance	I-Application
is	O
not	O
supported	O
,	O
and	O
a	O
class	O
managed	O
under	O
the	O
CLR	O
's	O
garbage	B-General_Concept
collector	I-General_Concept
cannot	O
inherit	O
more	O
than	O
one	O
class	O
.	O
</s>
<s>
Garbage	B-General_Concept
collection	I-General_Concept
:	O
the	O
CLR	O
is	O
fully	O
managed	O
by	O
a	O
garbage	B-General_Concept
collector	I-General_Concept
for	O
memory	O
management	O
automated	O
by	O
the	O
CLR	O
itself	O
,	O
i.e.	O
</s>
<s>
the	O
delete	O
operator	O
need	O
not	O
be	O
called	O
in	O
managed	B-Language
C++	I-Language
code	O
.	O
</s>
<s>
Interoperability	O
with	O
.NET	B-Application
languages	O
:	O
code	O
targeted	O
for	O
the	O
.NET	B-Application
Framework	I-Application
produces	O
Microsoft	O
Intermediate	O
Language	O
(	O
MSIL	O
,	O
similar	O
to	O
Java	B-Language
bytecode	O
)	O
output	O
and	O
thus	O
,	O
modules	O
compiled	O
and	O
components	O
(	O
assemblies	O
rather	O
)	O
can	O
be	O
reused	O
by	O
other	O
program	O
components	O
written	O
in	O
another	O
language	O
targeting	O
the	O
.NET	B-Application
Framework	I-Application
,	O
such	O
as	O
JScript	O
.NET	B-Application
,	O
C#	B-Application
,	O
Visual	B-Language
Basic	I-Language
.NET	I-Language
and	O
other	O
3rd	O
party	O
languages	O
for	O
.NET	B-Application
.	O
</s>
<s>
Binary	O
headers	O
:	O
allows	O
reusing	O
of	O
precompiled	O
metadata	O
;	O
any	O
.exe	O
,	O
.dll	O
,	O
.obj	O
or	O
.netmodule	O
compiled	O
into	O
MSIL	O
can	O
be	O
referenced	O
from	O
a	O
C++	B-Language
source	O
file	O
.	O
</s>
<s>
Buffer	B-General_Concept
overflow	I-General_Concept
protection	O
-	O
with	O
the	O
introduction	O
of	O
garbage	B-General_Concept
collection	I-General_Concept
into	O
C++	B-Language
,	O
Managed	B-Language
C++	I-Language
is	O
less	O
prone	O
to	O
the	O
common	O
buffer	B-General_Concept
overflow	I-General_Concept
errors	O
caused	O
by	O
the	O
absence	O
of	O
data	O
type	O
checking	O
in	O
standard	O
C++	B-Language
.	O
</s>
<s>
The	O
garbage	B-General_Concept
collector	I-General_Concept
helps	O
to	O
reduce	O
(	O
not	O
completely	O
though	O
)	O
the	O
frequency	O
of	O
these	O
errors	O
.	O
</s>
<s>
.NET	B-Application
framework	I-Application
Base	O
Class	O
Library	O
-	O
Managed	B-Language
C++	I-Language
also	O
has	O
the	O
potential	O
to	O
be	O
less	O
verbose	O
than	O
standard	O
unmanaged	O
code	O
,	O
since	O
all	O
managed	O
function	O
calls	O
and	O
inherited	O
classes	O
are	O
derived	O
from	O
the	O
.NET	B-Application
Framework	I-Application
Base	O
Class	O
Library	O
(	O
BCL	O
,	O
sometimes	O
referred	O
to	O
as	O
FCL	O
or	O
Framework	O
Class	O
Library	O
)	O
,	O
whose	O
API	O
provides	O
TCP/IP	O
networking	O
capabilities	O
,	O
textual	O
manipulation	O
functions	O
,	O
data	O
access	O
(	O
from	O
ODBC	O
to	O
SQL	O
)	O
,	O
XML	O
services	O
(	O
from	O
XSD	O
to	O
XSL	O
)	O
,	O
GUI	O
programming	O
(	O
Windows	O
Forms	O
)	O
,	O
mail	O
services	O
(	O
SMTP	O
)	O
,	O
cryptography	O
(	O
X509	O
Certificates	O
and	O
XML	O
digital	O
signatures	O
)	O
,	O
MSIL	O
generation	O
(	O
essentially	O
emitting	O
instructions	O
in	O
MSIL	O
)	O
,	O
file	O
I/O	O
,	O
manual	O
manipulation	O
of	O
the	O
CLR	O
garbage	B-General_Concept
collector	I-General_Concept
and	O
management	O
information	O
to	O
manipulate	O
the	O
WMI	O
console	O
.	O
</s>
<s>
This	O
allows	O
the	O
programmer	O
to	O
keep	O
unmanaged	O
code	O
that	O
cannot	O
be	O
ported	O
over	O
to	O
the	O
.NET	B-Application
Framework	I-Application
without	O
re-writing	O
it	O
completely	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
is	O
the	O
only	O
language	O
that	O
can	O
contain	O
unmanaged	O
code	O
and	O
natively	O
communicate	O
with	O
all	O
other	O
.NET	B-Application
languages	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
is	O
thus	O
very	O
convenient	O
for	O
interoperability	O
between	O
programmers	O
who	O
use	O
different	O
languages	O
,	O
including	O
those	O
in	O
the	O
.NET	B-Application
theater	O
and	O
those	O
who	O
use	O
standard	O
C++	B-Language
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
introduces	O
a	O
lot	O
of	O
new	O
keywords	O
and	O
syntactic	O
conventions	O
that	O
can	O
impair	O
the	O
readability	O
of	O
code	O
,	O
especially	O
if	O
C++	B-Language
code	I-Language
is	O
included	O
directly	O
and	O
interacts	O
directly	O
with	O
Managed	B-Language
C++	I-Language
code	I-Language
in	O
the	O
same	O
assembly	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
is	O
superseded	O
by	O
C++	B-Language
/CLI	I-Language
and	O
thus	O
obsolete	O
as	O
C++	B-Language
/CLI	I-Language
has	O
been	O
standardized	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
requires	O
a	O
slightly	O
longer	O
development	O
time	O
than	O
other	O
.NET	B-Application
languages	O
that	O
could	O
be	O
applied	O
to	O
projects	O
that	O
still	O
produce	O
the	O
same	O
results	O
.	O
</s>
<s>
The	O
use	O
of	O
pointers	O
may	O
or	O
may	O
not	O
be	O
a	O
requirement	O
,	O
because	O
managed	B-Language
C++	I-Language
has	O
both	O
value	O
types	O
( __value	O
struct	B-Application
and	O
__value	O
class	O
)	O
and	O
reference	O
types	O
( __gc	O
struct	B-Application
and	O
__gc	O
class	O
)	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
fully	O
support	O
ASP.NET	B-Application
web	O
applications	O
,	O
even	O
though	O
the	O
development	O
is	O
more	O
difficult	O
than	O
with	O
other	O
.NET	B-Application
languages	O
,	O
including	O
some	O
other	O
third	O
party	O
languages	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
includes	O
only	O
support	O
for	O
templates	O
(	O
for	O
interoperability	O
with	O
native	B-Language
C++	B-Language
)	O
but	O
no	O
support	O
for	O
generics	B-Language
(	O
for	O
interoperability	O
with	O
all	O
the	O
other	O
.NET	B-Application
languages	O
)	O
.	O
</s>
<s>
C++	B-Language
/CLI	I-Language
supports	O
both	O
templates	O
(	O
at	O
compile	O
time	O
)	O
and	O
generics	B-Language
(	O
at	O
run	O
time	O
)	O
.	O
</s>
<s>
The	O
following	O
examples	O
depict	O
the	O
use	O
of	O
Managed	B-Language
C++	I-Language
as	O
compared	O
to	O
standard	O
C++	B-Language
:	O
</s>
<s>
(	O
Global	O
change	O
)	O
Existing	O
C++	B-Language
to	O
be	O
ported	O
over	O
the	O
CLR	O
must	O
be	O
appended	O
with	O
the	O
following	O
:	O
</s>
<s>
/clr	O
enables	O
any	O
code	O
referencing	O
the	O
.NET	B-Application
Framework	I-Application
to	O
be	O
compiled	O
as	O
CIL	O
.	O
</s>
<s>
A	O
class	O
can	O
be	O
designated	O
to	O
be	O
garbage	B-General_Concept
collected	I-General_Concept
via	O
the	O
__gc	O
extension	O
keyword	O
.	O
</s>
<s>
The	O
preceding	O
code	O
can	O
be	O
compiled	O
and	O
executed	O
without	O
any	O
fear	O
of	O
memory	B-Error_Name
leaks	I-Error_Name
.	O
</s>
<s>
Because	O
class	O
gc	O
is	O
managed	O
under	O
the	O
garbage	B-General_Concept
collector	I-General_Concept
,	O
there	O
is	O
no	O
need	O
to	O
call	O
the	O
delete	O
operator	O
.	O
</s>
<s>
The	O
following	O
contains	O
main	O
points	O
and	O
programmatic	O
standards	O
that	O
differ	O
between	O
Managed	B-Language
C++	I-Language
and	O
other	O
well	O
known	O
programming	O
languages	O
that	O
are	O
similar	O
in	O
concept	O
.	O
</s>
<s>
native	B-Language
C++	B-Language
code	I-Language
may	O
be	O
faster	O
at	O
runtime	O
.	O
</s>
<s>
C++	B-Language
supports	O
generic	B-Language
programming	I-Language
.	O
</s>
<s>
Until	O
the	O
final	O
release	O
of	O
C++	B-Language
/CLI	I-Language
however	O
,	O
Managed	B-Language
C++	I-Language
programmers	O
must	O
revert	O
for	O
workarounds	O
for	O
using	O
generics	B-Language
.	O
</s>
<s>
C++	B-Language
supports	O
the	O
keyword	O
"	O
const	O
"	O
and	O
const	O
correctness	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
,	O
like	O
Java	B-Language
and	O
C#	B-Application
,	O
does	O
not	O
contain	O
this	O
feature	O
.	O
</s>
<s>
An	O
alternative	O
is	O
to	O
make	O
a	O
managed	O
class	O
immutable	B-Application
,	O
or	O
restricting	O
set	O
accessors	O
on	O
public	O
interfaces	O
.	O
</s>
<s>
C++	B-Language
code	I-Language
is	O
not	O
constricted	O
by	O
the	O
CLR	O
's	O
restrictions	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
__gc	O
classes	O
cannot	O
inherit	O
from	O
more	O
than	O
one	O
class	O
,	O
as	O
such	O
the	O
following	O
will	O
produce	O
a	O
compiler	O
error	O
:	O
</s>
<s>
Managed	B-Language
C++	I-Language
supports	O
a	O
greater	O
degree	O
of	O
reflection	B-Language
than	O
regular	O
C++	B-Language
,	O
which	O
is	O
generally	O
much	O
more	O
convenient	O
depending	O
on	O
the	O
function	O
of	O
the	O
code	O
,	O
or	O
what	O
the	O
code	O
is	O
intended	O
for	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
can	O
inter-operate	O
with	O
all	O
other	O
.NET	B-Application
capable	O
languages	O
,	O
including	O
other	O
third	O
party	O
languages	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
is	O
garbage	B-General_Concept
collected	I-General_Concept
.	O
</s>
<s>
In	O
standard	O
C++	B-Language
,	O
memory	O
management	O
and	O
allocation	O
is	O
the	O
responsibility	O
of	O
the	O
programmer	O
.	O
</s>
<s>
Running	O
Java	B-Language
code	I-Language
requires	O
an	O
appropriate	O
virtual	B-Architecture
machine	I-Architecture
,	O
while	O
running	O
Managed	B-Language
C++	I-Language
code	O
requires	O
an	O
appropriate	O
implementation	O
of	O
the	O
.NET	B-Application
Framework	I-Application
.	O
</s>
<s>
Java	B-Language
provides	O
a	O
documentation	O
on	O
the	O
source	O
code	O
,	O
while	O
Managed	B-Language
C++	I-Language
does	O
not	O
.	O
</s>
<s>
Java	B-Language
has	O
many	O
other	O
development	O
tools	O
available	O
for	O
Java	B-Language
programmers	O
to	O
use	O
,	O
while	O
Managed	B-Language
C++	I-Language
is	O
only	O
available	O
under	O
Visual	B-Application
Studio	I-Application
.NET	B-Application
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
can	O
access	O
the	O
computer	O
system	O
on	O
a	O
low	O
level	O
interface	O
much	O
more	O
easily	O
than	O
Java	B-Language
.	O
</s>
<s>
Java	B-Language
programmers	O
must	O
use	O
the	O
JNI	B-Language
(	O
Java	B-Language
Native	I-Language
Interface	I-Language
)	O
to	O
use	O
low	O
level	O
services	O
of	O
the	O
host	O
operating	O
system	O
.	O
</s>
<s>
While	O
C#	B-Application
supports	O
pointers	O
just	O
as	O
in	O
C++	B-Language
,	O
this	O
feature	O
is	O
turned	O
off	O
by	O
default	O
.	O
</s>
<s>
Like	O
Java	B-Language
,	O
C#	B-Application
is	O
syntactically	O
simpler	O
when	O
dealing	O
with	O
managed	O
code	O
.	O
</s>
<s>
C#	B-Application
can	O
achieve	O
basically	O
the	O
same	O
result	O
as	O
Managed	B-Language
C++	I-Language
,	O
as	O
all	O
syntactic	O
and	O
structural	O
conventions	O
remain	O
strikingly	O
similar	O
.	O
</s>
<s>
Managed	B-Language
C++	I-Language
,	O
though	O
it	O
is	O
a	O
strongly	O
typed	O
language	O
due	O
to	O
its	O
introduction	O
into	O
the	O
CLR	O
,	O
can	O
be	O
prone	O
to	O
errors	O
if	O
unmanaged	O
compiled	O
code	O
is	O
introduced	O
in	O
the	O
same	O
codebase	O
,	O
while	O
C#	B-Application
is	O
pure	O
MSIL	O
.	O
</s>
<s>
C#	B-Application
must	O
use	O
the	O
.NET	B-Application
Framework	I-Application
and	O
provided	O
class	O
libraries	O
to	O
access	O
the	O
computer	O
system	O
on	O
a	O
low	O
level	O
.	O
</s>
<s>
Porting	O
over	O
applications	O
to	O
the	O
.NET	B-Application
Framework	I-Application
from	O
C	O
or	O
C++	B-Language
is	O
much	O
easier	O
to	O
do	O
using	O
Managed	B-Language
C++	I-Language
.	O
</s>
<s>
The	O
Microsoft	B-Application
Visual	I-Application
C++	I-Application
.NET	B-Application
compiler	O
,	O
which	O
compiles	O
Managed	B-Language
C++	I-Language
to	O
target	O
the	O
.NET	B-Application
Framework	I-Application
,	O
produces	O
a	O
much	O
more	O
matured	O
set	O
of	O
instructions	O
in	O
its	O
resultant	O
assembly	O
,	O
thus	O
improving	O
performance	O
.	O
</s>
