滚龙

导航

保留字(Keywords)

在C/C++中,保留字也称为关键字。它是预先定义好的标识符,这些标识符对C++编译器有着特殊的含义。关键字不能被重新定义,在程序中用到的其他名称(标识符)不能与关键字有相同的拼法和大小写。

 

在ANSI C中,有32个保留字:

auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

 

在ANSI C++中,有62个保留字。相对于ANSI C,新增了30个(下表中粗体表示新增的)。

asm do inline short typeid
auto double int signed typename
bool dynamic_cast long sizeof union
break else mutable static unsigned
case enum namespace static_cast using
catch explicit new struct virtual
char extern operator switch void
class false private template volatile
const float protected this wchar_t
const_cast for public throw while
continue friend register true  
default goto reinterpret_cast try  
delete if return typedef  

 

在Visual C++中,则扩充了更多的保留字,具体请参考MSDN中的C++ Keywords主题。

posted on 2010-12-08 15:47  滚龙  阅读(370)  评论(0编辑  收藏  举报