📄 tools.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML>
<HEAD>
<LINK REL=STYLESHEET HREF=../INTRO/ECMEC.CSS>
<TITLE> A First Look at C++ Program Analyzers </TITLE>
<SCRIPT LANGUAGE="JavaScript" SRC="../JAVA/COOKIE.JS"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">var imagemax = 0; setCurrentMax(0);</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../JAVA/DINGBATS.JS"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../JAVA/SENDMETO.JS"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var dingbase = "TO_DIR.HTM";
var dingtext = "Meyers/Klaus, P";
if (self == top) {
top.location.replace(dingbase + this.location.hash);
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#ffffff" ONLOAD="setResize()">
<!-- SectionName="Meyers'/Klaus' A Look at C++ Program Analyzers" -->
<HR SIZE="1" NOSHADE>
<B><FONT COLOR="#663300" FACE="Helvetica" SIZE="-1">
This is a modified (primarily extended) version of an article that appeared in the February 1997 issue of <NOBR><FONT COLOR="#FF0000" SIZE="-2">°</FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=ddj" ONMOUSEOVER = "self.status = 'Dr. Dobbs\' Journal Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top"><I>Dr.</NOBR> Dobbs' Journal</I></A></NOBR>. Please note that the material in this article has, for the most part, <I>not</I> been updated since the research was originally performed in 1996.</FONT></B>
<HR SIZE="1" NOSHADE>
<P><A NAME="dingp1"></A><FONT ID="agtitle">A First Look at C++ Program Analyzers</FONT><SCRIPT>create_link(1);</SCRIPT>
</P>
<P><A NAME="dingp2"></A><A NAME="AUTO00001"></A><FONT FACE="Arial" SIZE="+1">by
<NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=smeyers" ONMOUSEOVER = "self.status = 'Scott Meyers Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Scott</NOBR> Meyers</A> and <NOBR><FONT COLOR="#FF0000" SIZE="-2"><b>°</b></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=mk" ONMOUSEOVER = "self.status = 'Martin Klaus Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Martin</NOBR> Klaus</A></FONT><SCRIPT>create_link(2);</SCRIPT>
</P>
<P><A NAME="dingp3"></A><A NAME="AUTO00002"></A> C++ has a well-deserved reputation for power and flexibility. It has
an equally well-deserved reputation for complexity; its gotchas are legion.
For example, omitting a virtual destructor in a base class typically leads
to incomplete destruction of derived class objects when they are deleted
through base class pointers (see <SCRIPT>sendmetoo(14,223029,'E');</SCRIPT> ONMOUSEOVER = "self.status = 'Item E14'; return true" ONMOUSEOUT = "self.status = self.defaultStatus">Item E14</A>).<SCRIPT>create_link(3);</SCRIPT>
</P>
<P><A NAME="dingp4"></A><A NAME="AUTO00003"></A> Experienced C++ programmers learn to avoid these kinds of problematic
constructs, but experience should not really be necessary: troublesome
C++ can often be detected by static analysis, i.e., by tools that parse
and analyze C++ source code. Such tools are becoming widely available,
and during the summer and fall of 1996, we undertook an investigation to
identify these tools and to assess their capabilities. In this article,
we summarize the initial results of our <NOBR>investigation.<SCRIPT>create_link(4);</SCRIPT>
</NOBR></P>
<P><A NAME="dingp5"></A><A NAME="AUTO00004"></A>We were interested in the following <NOBR>questions:<SCRIPT>create_link(5);</SCRIPT>
</NOBR></P>
<UL>
<A NAME="dingp6"></A><LI>What tools statically analyze C++ programs and issue warnings
about likely trouble spots? By focusing on <I>static</I>
analysis, we
limited our research to tools spiritually akin to <CODE>lint</CODE>. We
explicitly ignored tools designed to detect dynamic (runtime)
errors, such as programs that monitor memory usage and report on
leaks, etc. Such tools are important, but they offer functionality
that complements — not replaces — that of static analysis. We
also ignored products that focus on lexical issues (e.g., identifier
names, indentation style); our interest is in tools that identify
constructs that affect program <I>behavior</I>.<SCRIPT>create_link(6);</SCRIPT>
<A NAME="AUTO00005"></A>
<A NAME="dingp7"></A><LI>How comprehensive are the tools in identifying
suspect C++ constructs? C++ has many facets, including data
abstraction, inheritance, templates, exception handling, etc., and
we wanted to find tools that checked for likely errors in many of these
areas. A few tools checked only the C subset of C++, and we
ignored those offerings. Our interest is in tools for C++ programmers,
and C++ programmers have different needs from those of C programmers.<SCRIPT>create_link(7);</SCRIPT>
<A NAME="AUTO00006"></A>
<A NAME="dingp8"></A><LI>How well do the tools work on real programs? Can they parse real
source code? Do they scale well when run on large projects? Are
they robust enough to handle complex template instantiations,
including those generated by the Standard Template
Library (see <A HREF="#references" ONMOUSEOVER = "self.status = 'References'; return true" ONMOUSEOUT = "self.status = self.defaultStatus">References</A>)?<SCRIPT>create_link(8);</SCRIPT>
</UL>
<P><A NAME="dingp9"></A>This article addresses only the first two <NOBR>questions.<SCRIPT>create_link(9);</SCRIPT>
</NOBR></P>
<P><A NAME="dingp10"></A><FONT ID="aititle">Identifying Products</FONT><SCRIPT>create_link(10);</SCRIPT>
</P>
<P><A NAME="dingp11"></A>When we began this project, we were aware of several static analysis
tools for C++, but we suspected there were tools we didn't know about.
To fill the gaps in our knowledge, we posted a request for information
to several Usenet newsgroups, including groups devoted to C++
programming, object-oriented programming, and programming on various
platforms. Based on the responses we received, we identified the
offerings in Table <NOBR>1.<SCRIPT>create_link(11);</SCRIPT>
</NOBR></P>
<A NAME="AUTO00007"></A>
<CENTER>
<A NAME="table1"></A><TABLE WIDTH="85%" BORDER="0" CELLSPACING="3" CELLPADDING="3">
<TR><TH BGCOLOR="#000000"><FONT COLOR="#FFFFFF">Vendor</FONT></TH><TH BGCOLOR="#000000"><FONT COLOR="#FFFFFF">Product</FONT></TH><TH BGCOLOR="#000000"><FONT COLOR="#FFFFFF">Supported Under</FONT></TH></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=abraxas_software" ONMOUSEOVER = "self.status = 'Abraxas Software Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Abraxas</NOBR> Software</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=codecheck" ONMOUSEOVER = "self.status = 'CodeCheck Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">CodeCheck</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC" ALIGN=CENTER>DOS,Windows,Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=centerline_software" ONMOUSEOVER = "self.status = 'CenterLine Software Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">CenterLine</NOBR> Software</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=acquaprova" ONMOUSEOVER = "self.status = 'AcquaProva Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">AcquaProva</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC" ALIGN=CENTER>Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=consol_software" ONMOUSEOVER = "self.status = 'ConSol Software GmbH Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">ConSol</NOBR> Software GmbH</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=xlintpp" ONMOUSEOVER = "self.status = 'xlint++ Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">xlint++</NOBR></A></TD>
<TD ALIGN=CENTER BGCOLOR="#FFFFCC">Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=gimpel_software" ONMOUSEOVER = "self.status = 'Gimpel Software Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Gimpel</NOBR> Software</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=flexe_pc_lint" ONMOUSEOVER = "self.status = 'Flexe-/PC-Lint Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Flexe-/PC-Lint</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC" ALIGN=CENTER>DOS,Windows,Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=hp" ONMOUSEOVER = "self.status = 'Hewlett Packard Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Hewlett</NOBR> Packard</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=codeadvisor" ONMOUSEOVER = "self.status = 'CodeAdvisor Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">CodeAdvisor</NOBR></A></TD>
<TD ALIGN=CENTER BGCOLOR="#FFFFCC">Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=parasoft" ONMOUSEOVER = "self.status = 'ParaSoft Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">ParaSoft</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=codewizard" ONMOUSEOVER = "self.status = 'CodeWizard Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">CodeWizard</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC" ALIGN=CENTER>Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=productivity" ONMOUSEOVER = "self.status = 'Productivity Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Productivity</NOBR> through Software</A></TD>
<TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=prolint" ONMOUSEOVER = "self.status = 'Prolint Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">ProLint</NOBR></A></TD>
<TD BGCOLOR="#FFFFCC" ALIGN=CENTER>Unix</TD></TR>
<TR><TD BGCOLOR="#FFFFCC"><NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=prqa" ONMOUSEOVER = "self.status = 'Programming Research Ltd. Home Page'; return true" ONMOUSEOUT = "self.status = self.defaultStatus" TARGET="_top">Programming</NOBR> Research Ltd.</A></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -