<s>
In	O
the	O
C	B-Language
,	O
C++	B-Language
,	O
and	O
D	B-Application
programming	I-Application
languages	I-Application
,	O
a	O
type	B-Language
qualifier	I-Language
is	O
a	O
keyword	O
that	O
is	O
applied	O
to	O
a	O
type	O
,	O
resulting	O
in	O
a	O
qualified	O
type	O
.	O
</s>
<s>
In	O
D	B-Application
these	O
are	O
known	O
as	O
type	O
constructors	O
,	O
by	O
analogy	O
with	O
constructors	O
in	O
object-oriented	O
programming	O
.	O
</s>
<s>
Type	B-Language
qualifiers	I-Language
are	O
a	O
way	O
of	O
expressing	O
additional	O
information	O
about	O
a	O
value	O
through	O
the	O
type	O
system	O
,	O
and	O
ensuring	O
correctness	O
in	O
the	O
use	O
of	O
the	O
data	O
.	O
</s>
<s>
Type	B-Language
qualifiers	I-Language
are	O
not	O
generally	O
used	O
outside	O
the	O
C/C	O
++	O
family	O
of	O
languages	O
:	O
many	O
languages	O
have	O
a	O
notation	O
of	O
constants	O
,	O
but	O
express	O
this	O
by	O
the	O
name	O
binding	O
being	O
constant	O
(	O
a	O
"	O
variable	O
that	O
does	O
n't	O
vary	O
"	O
)	O
,	O
rather	O
than	O
through	O
the	O
type	O
system	O
;	O
see	O
alternatives	O
,	O
below	O
.	O
</s>
<s>
and	O
C11	O
,	O
there	O
are	O
four	O
type	B-Language
qualifiers	I-Language
in	O
standard	O
C	B-Language
:	O
const	O
(	O
C89	O
)	O
,	O
volatile	B-Operating_System
(	O
C89	O
)	O
,	O
restrict	B-Language
(	O
C99	B-Language
)	O
and	O
_Atomic	O
(	O
C11	O
)	O
–	O
the	O
latter	O
has	O
a	O
private	O
name	O
to	O
avoid	O
clashing	O
with	O
user-defined	O
names	O
.	O
</s>
<s>
The	O
first	O
two	O
of	O
these	O
,	O
const	O
and	O
volatile	B-Operating_System
,	O
are	O
also	O
present	O
in	O
C++	B-Language
,	O
and	O
are	O
the	O
only	O
type	B-Language
qualifiers	I-Language
in	O
C++	B-Language
.	O
</s>
<s>
Thus	O
in	O
C++	B-Language
the	O
term	O
"	O
cv-qualified	O
type	O
"	O
(	O
for	O
const	O
and	O
volatile	B-Operating_System
)	O
is	O
often	O
used	O
for	O
"	O
qualified	O
type	O
"	O
,	O
while	O
the	O
terms	O
"	O
c-qualified	O
type	O
"	O
and	O
"	O
v-qualified	O
type	O
"	O
are	O
used	O
when	O
only	O
one	O
of	O
the	O
qualifiers	O
is	O
relevant	O
.	O
</s>
<s>
Of	O
these	O
,	O
const	O
is	O
by	O
far	O
the	O
best-known	O
and	O
most	O
used	O
,	O
appearing	O
in	O
the	O
C	B-Language
and	O
C++	B-Language
standard	B-Library
libraries	I-Library
and	O
encountered	O
in	O
any	O
significant	O
use	O
of	O
these	O
languages	O
,	O
which	O
must	O
satisfy	O
const-correctness	O
.	O
</s>
<s>
For	O
a	O
time	O
however	O
volatile	B-Operating_System
was	O
used	O
by	O
some	O
C++	B-Language
programmers	O
for	O
synchronization	O
during	O
threading	O
,	O
though	O
this	O
was	O
discouraged	O
and	O
is	O
now	O
broken	O
in	O
most	O
compilers	O
.	O
</s>
<s>
In	O
D	B-Application
the	O
type	O
constructors	O
are	O
const	O
,	O
immutable	O
,	O
shared	O
,	O
and	O
inout	O
.	O
</s>
<s>
shared	O
is	O
used	O
for	O
shared	O
data	O
in	O
multi-threading	O
(	O
as	O
volatile	B-Operating_System
was	O
briefly	O
used	O
for	O
in	O
C++	B-Language
)	O
.	O
</s>
<s>
const	O
and	O
immutable	O
can	O
also	O
be	O
used	O
as	O
storage	B-Language
class	I-Language
specifiers	I-Language
.	O
</s>
<s>
In	O
C	B-Language
and	O
C++	B-Language
,	O
a	O
type	O
is	O
given	O
in	O
a	O
function	O
declaration	O
or	O
variable	O
declaration	O
by	O
giving	O
one	O
or	O
more	O
type	O
specifiers	O
,	O
and	O
optionally	O
type	B-Language
qualifiers	I-Language
.	O
</s>
<s>
where	O
const	O
is	O
a	O
type	B-Language
qualifier	I-Language
,	O
which	O
the	O
qualified	O
type	O
of	O
x	O
is	O
const	O
unsigned	O
int	O
and	O
the	O
unqualified	O
type	O
is	O
unsigned	O
int	O
.	O
</s>
<s>
Variable	O
declarations	O
further	O
have	O
an	O
optional	O
storage	B-Language
class	I-Language
specifier	I-Language
.	O
</s>
<s>
The	O
other	O
qualifier	O
in	O
C	B-Language
and	O
C++	B-Language
,	O
volatile	B-Operating_System
,	O
indicates	O
that	O
an	O
object	O
may	O
be	O
changed	O
by	O
something	O
external	O
to	O
the	O
program	O
at	O
any	O
time	O
and	O
so	O
must	O
be	O
re-read	O
from	O
memory	O
every	O
time	O
it	O
is	O
accessed	O
.	O
</s>
<s>
The	O
qualifier	O
is	O
most	O
often	O
found	O
in	O
code	O
that	O
manipulates	O
hardware	O
directly	O
(	O
such	O
as	O
in	O
embedded	B-Architecture
systems	I-Architecture
and	O
device	B-Application
drivers	I-Application
)	O
and	O
in	O
multithreaded	B-General_Concept
applications	O
(	O
though	O
often	O
used	O
incorrectly	O
in	O
that	O
context	O
;	O
see	O
external	O
links	O
at	O
volatile	B-Operating_System
variable	I-Operating_System
)	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
in	O
exactly	O
the	O
same	O
manner	O
as	O
const	O
in	O
declarations	O
of	O
variables	O
,	O
pointers	O
,	O
references	O
,	O
and	O
member	O
functions	O
,	O
and	O
in	O
fact	O
,	O
volatile	B-Operating_System
is	O
sometimes	O
used	O
to	O
implement	O
a	O
similar	O
design-by-contract	O
strategy	O
which	O
Andrei	O
Alexandrescu	O
calls	O
volatile-correctness	O
,	O
though	O
this	O
is	O
far	O
less	O
common	O
than	O
const-correctness	O
.	O
</s>
<s>
The	O
volatile	B-Operating_System
qualifier	O
also	O
can	O
be	O
stripped	O
by	O
const_cast	O
,	O
and	O
it	O
can	O
be	O
combined	O
with	O
the	O
const	O
qualifier	O
as	O
in	O
this	O
sample	O
:	O
</s>
<s>
Because	O
hardwareRegister	O
is	O
volatile	B-Operating_System
,	O
there	O
is	O
no	O
guarantee	O
that	O
it	O
will	O
hold	O
the	O
same	O
value	O
on	O
two	O
successive	O
reads	O
even	O
though	O
the	O
programmer	O
cannot	O
modify	O
it	O
.	O
</s>
<s>
The	O
notion	O
of	O
a	O
type	B-Language
qualifier	I-Language
was	O
introduced	O
,	O
along	O
with	O
the	O
example	O
of	O
readonly	O
(	O
later	O
renamed	O
const	O
)	O
by	O
Bjarne	O
Stroustrup	O
in	O
a	O
Bell	O
Labs	O
internal	O
Technical	O
Memorandum	O
of	O
1981	O
,	O
and	O
implemented	O
in	O
C	B-Language
with	O
Classes	O
,	O
the	O
predecessor	O
to	O
C++	B-Language
.	O
</s>
<s>
const	O
was	O
then	O
adopted	O
in	O
C	B-Language
as	O
part	O
of	O
standardization	O
,	O
and	O
appears	O
in	O
C89	O
(	O
and	O
subsequent	O
versions	O
)	O
along	O
with	O
another	O
type	B-Language
qualifier	I-Language
,	O
volatile	B-Operating_System
,	O
which	O
was	O
invented	O
by	O
the	O
ANSI	O
C	B-Language
standard	O
committee	O
(	O
X3J11	O
)	O
.	O
</s>
<s>
volatile	B-Operating_System
appeared	O
by	O
1985	O
;	O
and	O
an	O
early	O
use	O
was	O
in	O
compiling	O
the	O
UNIX	O
kernel	O
for	O
MIPS	B-Device
,	O
to	O
allow	O
optimized	O
compiling	O
by	O
preventing	O
usual	O
optimizations	O
from	O
being	O
applied	O
to	O
volatile	B-Operating_System
variables	I-Operating_System
.	O
</s>
<s>
A	O
further	O
qualifier	O
,	O
noalias	O
,	O
was	O
suggested	O
at	O
the	O
December	O
1987	O
meeting	O
of	O
the	O
X3J11	O
committee	O
,	O
but	O
was	O
rejected	O
;	O
its	O
goal	O
was	O
ultimately	O
fulfilled	O
by	O
the	O
restrict	B-Language
qualifier	O
in	O
C99	B-Language
.	O
</s>
<s>
The	O
motivation	O
for	O
noalias	O
was	O
complementary	O
to	O
volatile	B-Operating_System
,	O
namely	O
that	O
it	O
indicated	O
that	O
even	O
normally	O
unsafe	O
optimizations	O
could	O
be	O
performed	O
.	O
</s>
<s>
Ritchie	O
was	O
not	O
very	O
supportive	O
of	O
type	B-Language
qualifiers	I-Language
,	O
arguing	O
that	O
they	O
did	O
not	O
"	O
carry	O
their	O
weight	O
"	O
,	O
but	O
ultimately	O
did	O
not	O
argue	O
for	O
their	O
removal	O
from	O
the	O
standard	O
;	O
he	O
did	O
oppose	O
noalias	O
however	O
,	O
and	O
it	O
was	O
dropped	O
from	O
the	O
draft	O
.	O
</s>
<s>
Java	O
does	O
not	O
have	O
type	B-Language
qualifiers	I-Language
,	O
and	O
conspicuously	O
omitted	O
const	O
:	O
a	O
1999	O
proposal	O
to	O
add	O
it	O
was	O
rejected	O
,	O
notably	O
because	O
adding	O
it	O
after	O
the	O
fact	O
and	O
then	O
changing	O
the	O
standard	B-Library
library	I-Library
to	O
use	O
it	O
consistently	O
would	O
have	O
broken	O
compatibility	O
.	O
</s>
<s>
Examples	O
include	O
Ada	B-Language
83	I-Language
with	O
constant	O
objects	O
and	O
a	O
constant	O
keyword	O
,	O
and	O
Java	O
with	O
the	O
final	O
keyword	O
.	O
</s>
