一.after #include is <> or "" ?
标准库文件用<>
用户自己定义的头文件用“”
二。acdeRegCmds->addCommand();
//第一个为宏,第二个为增加命令组,用了后要用removeGroup("Command") 删除命令组;
#define : 符号常量、宏
1.符号常量:#define PI 3.14159
2.宏: #define CIRCLE_AREA(x) (PI*(x)*(x)) 如果超过一行,则必须要在最后加/
area=CIRCLE_AREA(4);
直接用4替换X再进行计算,值赋给area
三。extern的用法:
extern的意思是一个外部引用,不要编译器去找这个变量或者函数的定义位置;
例如你在a.h里面定义了int aaa=1;要在b.cpp里面使用这个aaa变量就得选择要么在b.cpp里面include a.h,要么在b.cpp中使用“extern int aaa;”连接的时候连接器会自己去找这个定义。
要么写包含个头文件,要么写extern让连接器自己去寻找定义!
void Hello()
{
ads_alert("Hello to All!");
}
显示一个提示框
四.typedef
TYPEDEF用来建立已经定义好的数据类型的别名。
如:typedef double ads_real;
建立了一个新的名字,但是没有建立一个新的类型。
可让程序有更好的可移植性。
5.&引用
int count=1;
int &c=count;
++c;
则C是COUNT的别名,所有对别(引用)的操作都是对原始变量本身的操作。
但只是个名,编译器不为别名保留空间。
6.const float PI=3.14159;
#define
They are the same
7.the diference from
int *const iPtr=&integer; //iPtr couldn't be changed,but the value it points to can be altered
const int *iPtr=&integer; //the value cann't be altered,but the pointer can point to other unit, Read-only pointer