float型参数不能直接传入数值,否则编译器不能判断它是double型还是float型
Write(string section , string key , float value)
Write(“Infor”,”Name”, 0.1);
//error
应传入float型变量
float p=0.1;
Write(“Infor”,”Name”, p);
//correct
子类不能用指针
SMConfig * m_config;
m_config=new SMConfig;
class SMConfig
{
template<class T>
class SectionWriter
{
}
}
m_config->SectionWriter<MAPS::value_type>(f); //error
SMConfig:: SectionWriter<MAPS::value_type>(f); //correct
free(buf)后buf!=NULL
不能直接把字符串常量赋值给char *
char * buf;
buf=(char *)malloc(256);
buf=”abc”;
//error, buf不是const char *,所以不能这样赋值
char * buf;
buf=(char *)malloc(256);
memcpy(buf,”abc”,3);
*(buf+3)=0
//0等于’/0’, 表示buf结尾,否则打印buf将打印abc及其后面的乱码
EA的用法
Project->Version Control->Work Offline
project view, 双击main, 右键check out,就可在本地改动文件了
画箭头:选中testcase的方框,再选中tool box中custom下 Dependency,从testcase方框内拖到函数方框内
画diagram frame: 右键 Insert element at cursor->diagram frame
把函数从Class Model模块下拖到Test Model模块下
toolbox下 custom->testcase, 右键 Advanced Settings->use rectangle notation