Keywords are identifiers reserved by the language
for special use. Although you can use them for preprocessor macro
names, it is considered poor programming style. Only the exact spelling
of keywords is reserved. For example,
auto is reserved
but
AUTO is not.
Table 1. C and C++ keywords auto
break
case
char
const
continue
default
do
|
double
else
enum
extern
float
for
goto
if
|
int
long
register
return
short
signed
sizeof
static
|
struct
switch
typedef
union
unsigned
void
volatile
while
|
In C++0x, the keyword
auto is
no longer used as a storage class specifier. Instead, it is used as
a type specifier, which can deduce the type of an
auto variable
from the type of its initializer expression.
The keyword extern was previously used
as a storage specifier or as part of a linkage specification. The
C++0x standard adds a third usage to use this keyword to specify explicit
instantiation declarations.
Standard C at the C99 level also reserves the following
keywords:
Table 2. C99 keywords _Bool
_Complex
|
_Imaginary1
inline
restrict
|
Note: - The keyword _Imaginary is reserved for possible
future use. For complex number functionality, use _Complex;
see Complex literals for details.
The C++ language also reserves the
following keywords:
Table 3. C++ keywords asm
bool
catch
class
const_cast
delete
dynamic_cast
explicit
|
export
decltype
false
friend
inline
mutable
namespace
new
|
operator
private
protected
public
reinterpret_cast
static_assert
static_cast
template
|
this
throw
true
try
typeid
typename
using
virtual
wchar_t
|
decltype and
static_assert are
two keywords in the C++0x standard.
Keywords for language extensions
(IBM extension)
In
addition to standard language keywords,
XL C/C++ reserves
the following keywords for use in language extensions:
Table 4. Keywords for C and
C++ language extensions __alignof
__alignof__
__asm (C only)
__asm__ (C only)
__attribute__
__attribute
bool (C only)1
__complex__
__const__
|
_Decimal324
_Decimal644
_Decimal1284
__extension__
__label__
__imag__
__inline__2
pixel1
__pixel1
__real__
|
__restrict
__restrict__
__signed__
__signed
__static_assert6
__volatile__
__thread5
typeof3
__typeof__
vector1
__vector1
|
Note: - These keywords are recognized only in a vector declaration context, when vector
support is enabled.
- The __inline__ keyword
uses the GNU C semantics for inline functions. For details, see Linkage of inline functions.
- typeof is
only recognized when -qkeyword=typeof is
in effect.
- These keywords are recognized only when -qdfp is
enabled.
- __thread is only recognized
when -qtls is
enabled.
- __static_assert is
a keyword for C language extension for compatibility with the C++0x
standard.
XL C++ reserves the following keywords
as language extensions for compatibility with C99.
Table 5. Keywords for C++ language extensions related to
C99 _Complex
_Imaginary1
_Pragma
restrict
|
Note: - The keyword _Imaginary is reserved for possible
future use. For complex number functionality, use _Complex;
see Complex literals for details.
More detailed
information regarding the compilation contexts in which extension
keywords are valid is provided in the sections of this information
that describe each keyword.