📄 articles.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> EC++ CD: Magazine Articles </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 = "INDEXDIR.HTM";
var dingtext = "Magazines, P";
if (self == top) {
top.location.replace(dingbase + this.location.hash);
}
</SCRIPT>
</HEAD>
<BODY bgcolor="#ffffff" OnLoad="setResize()">
<!-- SectionName="Magazines' Home Page -->
<A NAME="dingp1"></A><font ID="agtitle">Magazine Articles Home Page</font><SCRIPT>create_link(1);</SCRIPT>
<P><A NAME="dingp2"></A>
This CD includes the following articles. If you already know why they're here, just choose the one you want. Otherwise, please read my introductory comments below.<SCRIPT>create_link(2);</SCRIPT>
</P>
<UL>
<A NAME="dingp3"></A><LI><NOBR><A HREF="CA_FRAME.HTM" onMouseOver="self.status='Exception Handling: A False Sense of Security'; return true" onMouseOut="self.status=self.defaultStatus" TARGET="_top">Exception Handling: A False Sense of Security</A></NOBR> by <FONT COLOR="#FF0000" SIZE="-2"></FONT>Tom Cargill<SCRIPT>create_link(3);</SCRIPT>
</NOBR>.
<P><A NAME="dingp4"></A><LI><NOBR><A HREF="RE_FRAME.HTM" onMouseOver="self.status='Coping with Exceptions'; return true" onMouseOut="self.status=self.defaultStatus" TARGET="_top">Coping with Exceptions</A> by <FONT COLOR="#FF0000" SIZE="-2"></FONT>Jack W. Reeves</NOBR>.<SCRIPT>create_link(4);</SCRIPT>
<P><A NAME="dingp5"></A><LI><NOBR><A HREF="SU_FRAME.HTM" onMouseOver="self.status='Exception-Safe Generic Containers'; return true" onMouseOut="self.status=self.defaultStatus" TARGET="_top">Exception-Safe Generic Containers</A></NOBR> by Herb Sutter.<SCRIPT>create_link(5);</SCRIPT>
<P><A NAME="dingp6"></A><LI><NOBR><A HREF="CO_FRAME.HTM" onMouseOver="self.status='Counting Objects in C++'; return true" onMouseOut="self.status=self.defaultStatus" TARGET="_top">Counting Objects in C++</A></NOBR> by me (i.e., <FONT COLOR="#FF0000" SIZE="-2"></FONT>Scott Meyers</NOBR>).<SCRIPT>create_link(6);</SCRIPT>
<P><A NAME="dingp7"></A><LI><NOBR><A HREF="TO_FRAME.HTM" onMouseOver="self.status='A First Look at C++ Program Analyzers'; return true" onMouseOut="self.status=self.defaultStatus" TARGET="_top">A First Look at C++ Program Analyzers</A></NOBR> by me and Martin Klaus.<SCRIPT>create_link(7);</SCRIPT>
</UL>
<HR ALIGN="LEFT" SIZE="1" WIDTH="100%">
<P><A NAME="dingp8"></A>
When I wrote <NOBR><A HREF="../MEC/INDEX.HTM" TARGET="_top" onMouseOver = "self.status = 'More Effective C++'; return true" onMouseOut = "self.status = self.defaultStatus"><I>More Effective C++</I></A></NOBR> in 1995, I had this to say
about exception-handling and C++:<SCRIPT>create_link(8);</SCRIPT>
</P>
<BLOCKQUOTE>
<A NAME="dingp9"></A>
There is much the C++ community does not know about writing programs using
exceptions, including, for the most part, how to do it correctly. There is
as yet no agreement on a body of techniques that, when applied routinely,
leads to software that behaves predictably and reliably when exceptions are
thrown.<SCRIPT>create_link(9);</SCRIPT>
</BLOCKQUOTE>
<A NAME="dingp10"></A>
Much has changed since 1995. Enormous strides have been made in describing
how to write <I>exception-safe</I> code — code that behaves well when
exceptions are thrown. The articles that follow describe the progress in
this area, and they complement my treatment of exceptions in Items <A HREF="../MEC/MI9_FR.HTM" TARGET="_top" onMouseOver = "self.status = 'Go to Item 9'; return true" onMouseOut = "self.status = self.defaultStatus">9</A>-<A HREF="../MEC/MI15_FR.HTM" TARGET="_top" onMouseOver = "self.status = 'Go to Item 15'; return true" onMouseOut = "self.status = self.defaultStatus">15</A> of
<A HREF="../MEC/INDEX.HTM" TARGET="_top" onMouseOver = "self.status = 'More Effective C++'; return true" onMouseOut = "self.status = self.defaultStatus"><I>More Effective C++</I></A>. I'm grateful that the authors of these articles have allowed me to include them on this CD.<SCRIPT>create_link(10);</SCRIPT>
<ul>
<A NAME="dingp11"></A><LI><NOBR><A HREF="CA_FRAME.HTM" TARGET="_top" onMouseOver = "self.status = 'Exception Handling: A False Sense of Security'; return true" onMouseOut = "self.status = self.defaultStatus">"Exception Handling: A False Sense of Security"</A></NOBR> by <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=cargill" onMouseOver="self.status='Tom Cargill Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top">Tom Cargill</A></NOBR>. It's hard to
overestimate the influence this article had on the C++ community when
it appeared in the November-December 1994 issue of the <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=cppreport"
onMouseOver="self.status='C++ Report Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top"><I>C++ Report</I></A></NOBR>. At that
time, most C++ programmers thought there was little more to exceptions
that <code>try</code>, <code>throw</code>, and <code>catch</code>.
Tom showed just how wrong that was. (They didn't call his column "C++
Gadfly" for nothing.) He demonstrated that writing
exception-safe code isn't just hard, it's <I>really</I> hard.
In addition, Tom challenged the C++ community to come up with rules
for writing exception-safe programs. It took years before
those rules began to appear in print, and the difficulties Tom identified
affected work on the standard C++ library (see <NOBR>Items <SCRIPT>sendmetoo(49,8392,'E')</SCRIPT> onMouseOver="self.status='Familiarize yourself with the C++ standard library.'; return true" onMouseOut="self.status=self.defaultStatus">E49</A></NOBR> and <NOBR><SCRIPT>sendmetoo(35,5473,'M');</SCRIPT> onMouseOver="self.status='Familiarize yourself with the C++ standard library.'; return true" onMouseOut="self.status=self.defaultStatus">M35</A></NOBR>) until the final days of
its specification.<SCRIPT>create_link(11);</SCRIPT>
<br><br>
<A NAME="dingp12"></A><LI><NOBR><A HREF="RE_FRAME.HTM" TARGET="_top" onMouseOver="self.status='Coping with Exceptions'; return true" onMouseOut="self.status=self.defaultStatus">"Coping with Exceptions"</A></NOBR> by <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=reeves" onMouseOver="self.status='Jack Reeves Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top">Jack W. Reeves</A></NOBR>. Jack was
not the first to respond to Tom Cargill's challenge, but his March
1996 <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=cppreport"
onMouseOver="self.status='C++ Report Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top"><I>C++ Report</I></A></NOBR>
article was the first to describe how to achieve exception safety
in a way I could easily understand. He explained how even normal
programmers could write code that behaves well in the presence
of exceptions.<SCRIPT>create_link(12);</SCRIPT>
<br><br>
<A NAME="dingp13"></A><LI><NOBR><A HREF="SU_FRAME.HTM" TARGET="_top" onMouseOver="self.status='Exception-Safe Generic Containers.'; return true" onMouseOut="self.status=self.defaultStatus">"Exception-Safe Generic Containers"</A></NOBR> by
<NOBR><FONT COLOR="#FF0000" SIZE="-2">°</FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=hs" onMouseOver = "self.status = 'Herb Sutter Home Page'; return true" onMouseOut = "self.status = self.defaultStatus" target="_top">Herb</NOBR> Sutter</A> is a wonderful companion to Jack Reeves' article,
because it focuses on how to achieve exception safety in templated
containers. This is a tricky business, because the containers' member
functions have no idea what types of objects they contain, what types
of exceptions they may throw, or the conditions under which they may
throw them. Jack Reeves considered many of these problems in his
article, but Sutter's
approach is both different and, in my mind, simpler. Certainly they
are both instructive.
Sutter's original article appeared in two installments in the
<NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=cppreport" onMouseOver="self.status='C++ Report Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top"><I>C++ Report</I></A></NOBR>
(September and November-December 1997), but for this CD, Herb has
allowed me to combine them into a single article.<SCRIPT>create_link(13);</SCRIPT>
<br><br>
</UL>
<A NAME="dingp14"></A>
The following articles have nothing to do with exception handling, but they
dovetail nicely with other material on this CD. My article on counting
objects shows how different C++ language features can interact in
interesting, surprising, and useful ways. The piece by Martin Klaus and me
gives some background on what to look for when evaluating
<code>lint</code>-like tools for C++, i.e., tools that check C++ source
code for violations of the kinds of rules I describe in my books.<SCRIPT>create_link(14);</SCRIPT>
<ul>
<A NAME="dingp15"></A><LI><NOBR><A HREF="CO_FRAME.HTM" TARGET="_top" onMouseOver="self.status='Counting Objects in C++'; return true" onMouseOut="self.status=self.defaultStatus">"Counting Objects in C++"</A></NOBR> by me (i.e., <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 Meyers</A></NOBR>). In <NOBR><SCRIPT>sendmetoo(14,223029,'E')</SCRIPT> onMouseOver="self.status='Constructors, Destructors, and Assignment Operators'; return true" onMouseOut="self.status=self.defaultStatus">Item E14</A></NOBR>, I describe a simple way to keep track of how
many objects of a class exist, but I fail to address the fact that I
write the code twice, once for each of two classes. Shame on me; code
duplication is <I>bad</I>. It seems like it should be easy to make
the object-counting code reusable, but it turns out to require an
understanding of public and private inheritance, templates, the
interaction of new and delete, the implementation of virtual
functions, implicit type conversions, and valid compiler
optimizations. In this April 1998 <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></FONT><A HREF="http://www.awl.com/cseng/cgi-bin/cdquery.pl?name=cuj"
onMouseOver="self.status='C/C++ Users Journal Home Page'; return true" onMouseOut="self.status=self.defaultStatus" target="_top"><I>C/C++</NOBR>
Users Journal</I></A></NOBR> article, I prattled on about all these issues.<SCRIPT>create_link(15);</SCRIPT>
<br><br>
<A NAME="dingp16"></A><LI><NOBR><A HREF="TO_FRAME.HTM" TARGET="_top" onMouseOver="self.status='A First Look at C++ Program Analyzers'; return true" onMouseOut="self.status=self.defaultStatus">"A First Look at C++ Program Analyzers"</A></NOBR> 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">me</NOBR></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>. In the preface to the original 1992 edition of
<NOBR><A HREF="../EC/INDEX.HTM" TARGET="_top" onMouseOver="self.status='Effective C++'; return true" onMouseOut="self.status=self.defaultStatus"><I>Effective
C++</I></A></NOBR>, I noted my interest in <code>lint</code>-like
tools for C++, and in this article from the February 1997 issue of <NOBR><FONT COLOR="#FF0000" SIZE="-2"><B>°</B></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> Dobb's Journal</I></A></NOBR>, Martin and I
examined five C++ compilers and nine <code>lint</code>-like programs
to see how well they were able to identify 36 problematic conditions
in C++ source code. The raw data in this article are now out of date,
but the analysis remains valid. Furthermore, the links to home pages
for commercial <code>lint</code>-like tools make this a convenient
starting point for developers interested in tools of this nature.<SCRIPT>create_link(16);</SCRIPT>
<br><br>
</UL>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -