首页 > 代码库 > C++关键字(保留字)
C++关键字(保留字)
C++ 关键字
__abstract 2 | __alignof 运算符 | __asm |
__assume | __based | __box 2 |
__cdecl | __declspec | __delegate 2 |
__event | __except | __fastcall |
__finally | __forceinline | __gc 2 |
__hook 3 | __identifier | __if_exists |
__if_not_exists | __inline | __int16 |
__int32 | __int64 | __int8 |
__interface | __leave | __m128 |
__m128d | __m128i | __m64 |
__multiple_inheritance | __nogc 2 | __noop |
__pin 2 | __property 2 | __raise |
__sealed 2 | __single_inheritance | __stdcall |
__super | __thiscall | __try/__except, __try/__finally |
__try_cast 2 | __unaligned | __unhook 3 |
__uuidof | __value 2 | __virtual_inheritance |
__w64 | __wchar_t, wchar_t | abstract |
array | auto | bool |
break | case | catch |
char | Class — 类 | const |
const_cast | continue | decltype |
default | Delegate — 委托 | 删除 |
deprecated 1 | dllexport 1 | dllimport 1 |
do | double | dynamic_cast |
else | enum | enum class |
enum struct | Event — 事件 | 显式 |
extern | false | finally |
float | for | for each, in |
friend | friend_as | gcnew |
generic | goto | if |
initonly | inline | int |
interface class | interface struct | interior_ptr |
literal | long | mutable |
naked 1 | namespace | new |
new | noinline 1 | noreturn 1 |
nothrow 1 | novtable 1 | nullptr |
operator | private | 属性 |
property 1 | protected | public |
ref class | ref struct | register |
reinterpret_cast | return | safecast |
sealed | selectany 1 | short |
signed | sizeof | static |
static_assert | static_cast | struct |
switch | Template — 模板 | this |
thread 1 | throw | true |
try | typedef | typeid |
typeid | typename | union |
unsigned | using declaration, using directive | uuid 1 |
value class | value struct | virtual |
void | volatile | while |
根据其内容可将其细分一下:
基本的数据类型关键字:void, int, char, float, double, bool
类型修饰关键字:long, short, singed, unsigned
布尔型字面值:true, false
非常重要的变量声明修饰符:const, inline
存储类别关键字:auto, static, extern, , register
控制结构关键字:for, while, if, else, do
switch语句关键字:switch, case, default
路径跳转关键字:break, continue, return, goto
动态创建变量关键字:new, delete
长度运算符:sizeof
复合类型关键字:class, struct, enum, union, typedef
与类成员相关关键字:this, friend, virtual, mutable, explicit, operator
派生类继承方式:private, protected, public
模板:template, typename
命名空间:namespace, using
异常处理:catch, throw, try,
各种操作符的替代名:and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
其他不常用的:asm, export, typeid, volatile
在cena中time 是保留的 如果拿 time 做变量名 会 无法编译
——以上部分内容摘自网络及Microsoft MSDN
老师说 ——我们尽量不要用英文全拼 可以用缩写 或者把首字母大写 还有很多方法避免掉坑里的 比如:用汉语拼音
很神奇吧 如果你也遇到了类似的灵异事件 欢迎在评论中抱怨 我会补充
——张旺作品
C++关键字(保留字)