Keywords in C and C++
Keywords are identifiers reserved by the
language for special use. Although you can use them for
preprocessor macro names, it is poor programming practice. Only
the exact spelling of keywords is reserved (recall, C++ is case
sensitive therefore auto is not the same as AUTO).
Keywords Common in C and C++ |
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 |
|
|
|
|
|
There are also a set of keywords that are specific to
the C++ language:
Keywords for C++ only |
asm |
bool |
catch |
class |
const_cast |
delete |
dynamic_cast |
explicit |
false |
friend |
inline |
mutable |
namespace |
new |
operator |
private |
protected |
public |
reinterpret_cast |
static_cast |
template |
this |
throw |
true |
try |
typeid |
typename |
virtual |
using |
wchar_t |
|
The IBM C and C++ Compilers also reserves the
following keywords. They are IBM C and C++ Compilers extensions to
the existing language standards.
Additional IBM C and C++ Compilers
Keywords |
_Builtin |
__builtin |
_Cdecl |
__cdecl |
__declspec |
_Export |
__export |
__except |
_Far16 |
__far16 |
_Far32 |
__far32 |
_Fastcall |
__fastcall |
__finally |
_Import |
__import |
__int64 |
_Inline |
__inline |
__int8 |
__int16 |
__int32 |
__leave |
_Optlink |
__optlink |
_Pascal |
__pascal |
_Packed |
__packed |
__stdcall |
_System |
__system |
__thread |
__try |
__unaligned |
|
There are also keywords that are reserved for C only:
Keywords for C only |
_Far32 |
__far32 |
_Inline |
__inline |
_Packed |
__packed |
_Pascal |
_Far32 _Pascal |
_Far16 _Cdecl |
_Far16 _Pascal |
_Far16 _Fastcall |
__except |
__finally |
__leave |
__try |
_inline |
|
The following keywords are reserved for
Microsoft Visual C++ compatibility:
Keywords for Microsoft Visual C++
Compatibility |
_asm |
__asm |
_cdecl |
_declspec |
_except |
_finally |
_inline |
_int8 |
_int16 |
_int32 |
_int64 |
_leave |
_stdcall |
_try |
|
|
|