求助:用pclint9对C++做的代码检查错误如何解决
本帖最后由 lixue2011 于 2011-8-30 16:32 编辑 大家好:
小妹刚开始学习使用pclint进行代码检查,以下是用pclint9做的静态代码检查结果以及开发人员的分析处理结果,请各位大侠帮忙看一下有没有什么更好的见解或处理方式:
stdafx.h包含以下头文件:
#include <Gdiplus.h>
#include <tlhelp32.h>
#include <Wincrypt.h>
#include <string.h>
extern "C"
{
#include <hidsdi.h>
#include <setupapi.h>
}
#include <Dbt.h>
#include "Define.h"
#include "Func.h"
handler.h包含以下头文件:
#include "wmltypes.h"
handler.cp包含以下头文件:
#include "stdafx.h"
#include "handler.h"
#include "util.h"
#include "entities.h"
#include "wml.h"
#include "goudian.h"
#include "jiaofa.h"
#include "deck.h"
#include "pair.h"
#include "bind.h"
#include "parse.h"
--- Module: E:\PClint\MiniPayII\handler.cpp (C++)
strdup (wml->getted_data);
E:\PClint\MiniPayII\handler.cpp(61): error 1055: (Error -- Symbol 'strdup()' undeclared, assumed to return int)
E:\PClint\MiniPayII\handler.cpp(61): error 64: (Error -- Type mismatch (assignment) (char * = int))
开发解释:在VC中已经间接地包含了头文件,所以不需要处理。
wml->opt_tail->text = strdup (wml->getted_data);
E:\PClint\MiniPayII\handler.cpp(69): error 64: (Error -- Type mismatch (assignment) (char * = int))
开发解释:在VC中已经间接地包含了头文件,所以不需要处理。
HtmlCtrl.cpp包含以下头文件:
#include "StdAfx.h"
#include "HtmlCtrl.h"
--- Module: E:\PClint\MiniPayII\HtmlCtrl.cpp (C++)
DECLARE_MESSAGE_MAP();
E:\PClint\MiniPayII\HtmlCtrl.h(26): error 19: (Error -- Useless Declaration)
开发解释:这是VC中标准的定义消息映射的写法,不是错误
varLanguage.vt = VT_BSTR;
E:\PClint\MiniPayII\HtmlCtrl.cpp(43): error 1013: (Error -- Symbol 'vt' not a member of class 'tagVARIANT')
E:\PClint\MiniPayII\HtmlCtrl.cpp(43): error 40: (Error -- Undeclared identifier 'vt')
E:\PClint\MiniPayII\HtmlCtrl.cpp(43): error 63: (Error -- Expected an lvalue)
//在VC中vt确实是tagVARIANT的成员,不是错误
hr = frameOut.pdispVal->QueryInterface(IID_IHTMLWindow2,reinterpret_cast<void**>(&spChildWindow));
E:\PClint\MiniPayII\HtmlCtrl.cpp(77): error 48: (Error -- Bad type)
E:\PClint\MiniPayII\HtmlCtrl.cpp(77): error 10: (Error -- Expecting a structure or union)
E:\PClint\MiniPayII\HtmlCtrl.cpp(77): error 1013: (Error -- Symbol 'QueryInterface' not a member of class '')
E:\PClint\MiniPayII\HtmlCtrl.cpp(77): error 1055: (Error -- Symbol 'QueryInterface' undeclared, assumed to return int)
开发解释:这是Windows编程标准的“查询接口”的方法,不是错误
frameOut.pdispVal->Release();
E:\PClint\MiniPayII\HtmlCtrl.cpp(88): error 48: (Error -- Bad type)
E:\PClint\MiniPayII\HtmlCtrl.cpp(88): error 10: (Error -- Expecting a structure or union)
E:\PClint\MiniPayII\HtmlCtrl.cpp(88): error 1013: (Error -- Symbol 'Release' not a member of class '')
E:\PClint\MiniPayII\HtmlCtrl.cpp(88): error 1055: (Error -- Symbol 'Release' undeclared, assumed to return int)
开发解释:这是Windows编程标准的“查询接口”的方法,不是错误
[ 本帖最后由 lixue2011 于 2011-8-30 16:54 编辑 ]