1.父类子类都有同类型同名变量,子类的可以去掉;
2.Assert statement calls a function which may have desired side effects: 'type'. assert(token->type()==TOKEN_CAMERA);
3.无符号整形打印用%u,
整数int类型用%d
long用%ld
unsigned long用%lu
而size_t在C99标准用%zu,在vs2008——2013用%Iu,在vs2015又支持%Iu。
打印:unsigned long为%lu, unsigned int为%u, C99标准size_t为%zu.
fprintf(f,"level%d has %lu dance\n",i,danceitem_bylev[i].size());
in format string (no. 2) requires 'int' but the argument type is 'size_t {aka unsigned long}',代码中此处改为%Iu,由于环境是vs2008.
4.DWORD实际上是unsigned int。
5.H3DVec3 leftDown(aabb[0], aabb[1], aabb[2]);可能存在空指针,
修改:
if(aabb==NULL)
return;
H3DVec3 leftDown(aabb[0], aabb[1], aabb[2]);
6.f = fopen("action_move_list.txt","w");
加上fclose(f);
7.CreateThread(NULL,0,p,(LPVOID)this,0,0);返回值可能没被用到,解决:
HANDLE hThread = CreateThread(NULL,0,p,(LPVOID)this,0,0);
if(hThread==NULL){
msg("Create PLAYING Thread failed");
return false;
}
m_handle = h_Thead;
头文件定义HANDLE m_handle;
构造函数初始化m_handle = NULL;
析构函数if(m_handle)
{
WaitForSingleObject(m_handle, INFINITE);
CloseHandle(m_handle);
}
9.for(std::vector<CTokenRyth*>::const_iterator it=tokenlist.begin();it!=tokenlist.end();++it) 这里it用前缀比后缀好
10.if (sel.choiceList.size())
{
}改为
if(!sel.choiceList.empty())
{}
11.string类型不需要初始化。
12.CToken* token = *it;
token = NULL;
delete token;
第一个赋值还没用,就被重复赋值。改为:
CToken* token = *it;
delete token;
token = NULL;
DWORD ret = pfnMiniDumpWriteDump(
GetCurrentProcess(),
GetCurrentProcessId(),
file,
MiniDumpNormal,
//MiniDumpFilterMemory,
&eInfo,
NULL,
NULL );
ret = CloseHandle( file );
可以改为
//DWORD ret = pfnMiniDumpWriteDump(
// GetCurrentProcess(),
// GetCurrentProcessId(),
// file,
// MiniDumpNormal,
// //MiniDumpFilterMemory,
// &eInfo,
// NULL,
// NULL );
DWORD ret = CloseHandle( file );