C++一点感司

来源:互联网 发布:mac迅雷提示信任 编辑:程序博客网 时间:2024/05/02 03:46

标识(Identifiers)

有效标识由字母(letter),数字(digits)和下划线 ( _ )组成。标识的长度没有限制,但是有些编译器只取前32个字符(剩下的字符会被忽略)。

空格(spaces),标点(punctuation marks)和符号(symbols) 都不可以出现在标识中。 只有字母(letters),数字(digits) 和下划线(_)是合法的。并且变量标识必须以字母开头。标识也可能以下划线(_)开头,但这种标识通常是保留给为外部连接用的。标识不可以以数字开头。

必须注意的另一条规则是当你给变量起名字时不可以和C++语言的关键字或你所使用的编译器的特殊关键字同名,因为这样与这些关键字产生混淆。例如,以下列出标准保留关键字,他们不允许被用作变量标识名称:

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

另外,不要使用一些操作符的替代表示作为变量标识,因为在某些环境中它们可能被用作保留词:

and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq

你的编译器还可能包含一些特殊保留词,例如许多生成16位码的编译器(比如一些DOS编译器)把 far, huge和 near也作为关键字。

非常重要:C++语言是“ 大小写敏感”(“case sensitive”) 的,即同样的名字字母大小写不同代表不同的变量标识。因此,例如变量RESULT,变量result和变量Result分别表示三个不同的变量标识.

 

基本数据类型(Fundamental Data types)

http://v.17173.com/playlist_16647084?retcode=0
http://v.17173.com/playlist_16646343?retcode=0
http://v.17173.com/playlist_16645606?retcode=0
http://v.17173.com/playlist_16644847?retcode=0
http://v.17173.com/playlist_16644531?retcode=0
http://v.17173.com/playlist_16643651?retcode=0
http://v.17173.com/playlist_16642300?retcode=0
http://v.17173.com/playlist_16641603?retcode=0
http://v.17173.com/playlist_16640802?retcode=0
http://v.17173.com/playlist_16639970?retcode=0
http://v.17173.com/playlist_16638879?retcode=0
http://v.17173.com/playlist_16637879?retcode=0
http://v.17173.com/playlist_16637129?retcode=0
http://v.17173.com/playlist_16636395?retcode=0
http://v.17173.com/playlist_16635430?retcode=0
http://v.17173.com/playlist_16634717?retcode=0
http://v.17173.com/playlist_16633978?retcode=0
http://v.17173.com/playlist_16633361?retcode=0
http://v.17173.com/playlist_16632679?retcode=0
http://v.17173.com/playlist_16631929?retcode=0
http://v.17173.com/playlist_16631235?retcode=0
http://v.17173.com/playlist_16630442?retcode=0
http://v.17173.com/playlist_16629659?retcode=0
http://v.17173.com/playlist_16628775?retcode=0
http://v.17173.com/playlist_16627962?retcode=0
http://v.17173.com/playlist_16626885?retcode=0
http://v.17173.com/playlist_16626031?retcode=0
http://v.17173.com/playlist_16625187?retcode=0
http://v.17173.com/playlist_16624338?retcode=0
http://v.17173.com/playlist_16623563?retcode=0
http://v.17173.com/playlist_16622782?retcode=0
http://v.17173.com/playlist_16621927?retcode=0
http://v.17173.com/playlist_16621058?retcode=0
http://v.17173.com/playlist_16620090?retcode=0
http://v.17173.com/playlist_16619172?retcode=0
http://v.17173.com/playlist_16618194?retcode=0
http://v.17173.com/playlist_16617354?retcode=0
http://v.17173.com/playlist_16616530?retcode=0
http://v.17173.com/playlist_16615706?retcode=0
http://v.17173.com/playlist_16614722?retcode=0
http://v.17173.com/playlist_16613787?retcode=0
http://v.17173.com/playlist_16613068?retcode=0
http://v.17173.com/playlist_16612261?retcode=0
http://v.17173.com/playlist_16611494?retcode=0
http://v.17173.com/playlist_16610758?retcode=0
http://v.17173.com/playlist_16609837?retcode=0
http://v.17173.com/playlist_16608681?retcode=0
http://v.17173.com/playlist_16607859?retcode=0
http://v.17173.com/playlist_16606880?retcode=0
http://v.17173.com/playlist_16605763?retcode=0
http://v.17173.com/playlist_16604378?retcode=0
http://ameblo.jp/ny6688/entry-11803647598.html
http://ameblo.jp/ny6688/entry-11803647598.html
http://ameblo.jp/ny6688/entry-11803647598.html
http://ameblo.jp/ny6688/entry-11803647598.html
http://ameblo.jp/ny6688/entry-11803647598.html
http://ameblo.jp/ny6688/entry-11803647598.html


0 0