📄 ch01.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD> <META NAME="Author" Content="Steph Mineart"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> <TITLE>ANSI/ISO C++ Professional Programmer's Handbook - Chapter 1 - Introduction</TITLE> <link rel="stylesheet" TYPE="text/css" href="/includes/stylesheets/ebooks.css"></head><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER> <H1><img src="/publishers/que/series/professional/0789720221/button/que.gif" width="171" height="66"><BR> ANSI/ISO C++ Professional Programmer's Handbook</H1></CENTER><CENTER> <P><A HREF="/publishers/que/series/professional/0789720221/index.htm"><img src="/publishers/que/series/professional/0789720221/button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><H1 align="center">1</H1><h1 align="center"> Introduction </h1><address>by Danny Kalev</address><ul> <li><a href="#Heading1">The Origins of C++</a> <ul> <li><a href="#Heading2">C with Classes</a> <li><a href="#Heading3">Enter C++</a> <li><a href="#Heading4">The Late 1980s: Opening the Floodgates</a> </ul> <li><a href="#Heading5">ANSI Committee Established</a> <ul> <li><a href="#Heading6">Maturation</a> <li><a href="#Heading7">International Standardization</a> <li><a href="#Heading8">Committee Drafts And Public Review</a> <li><a href="#Heading9">Feature Freeze and Finalization</a> </ul> <li><a href="#Heading10"> C++ as Opposed to Other Object-Oriented Languages</a> <ul> <li><a href="#Heading11"> Backward Compatibility with Legacy Systems</a> <li><a href="#Heading12"> Performance</a> <li><a href="#Heading13"> Object-Orientation and Other Useful Paradigms</a> <li><a href="#Heading14">Object-Oriented Programming</a> <li><a href="#Heading15">Generic Programming</a> </ul> <li><a href="#Heading16">Aim Of the Book</a> <li><a href="#Heading17"> Target Audience</a> <li><a href="#Heading18">Organization of the Book</a> </ul><hr size=4><p>The precursors of object-oriented programming can be traced back to the late 1960's: Classes, inheritance and virtual member functions were integral features of Simula67, a programming language that was mainly used for writing event-driven simulations. When Smalltalk first appeared back in 1972, it offered a pure object-oriented programming environment. In fact, Smalltalk defined object-oriented programming. This style of programming was so innovative and revolutionary at the time that it took more than a decade for it to become a standard in the software industry. Undoubtedly, the emergence of C++ in the early '80s provided the most considerable contribution to this revolution.</p><h2> <a name="Heading1">The Origins of C++</a></h2><p>In 1979, a young engineer at Bell (now AT&T) Labs, Bjarne Stroustrup, started to experiment with extensions to C to make it a better tool for implementing large-scale projects. In those days, an average project consisted of tens of thousands of lines of code (LOC).</p><blockquote> <hr> <strong>NOTE: </strong> Today, Microsoft's Windows 2000 (formerly NT 5.0) consists of more than 30 million lines of code (and counting). <hr></blockquote><p>When projects leaped over the 100,000 LOC count, the shortcomings of C became noticeably unacceptable. Efficient teamwork is based, among other things, on the capability to decouple development phases of individual teams from one another--something that was difficult to achieve in C.</p><h3> <a name="Heading2">C with Classes</a></h3><p>By adding classes to C, the resultant language -- "C with classes" -- could offer better support for encapsulation and information hiding. A <i>class</i> provides a distinct separation between its internal implementation (the part that is more likely to change) and its external interface. A class object has a determinate state right from its construction, and it bundles together the data and operations that manipulate it.</p><h3> <a name="Heading3">Enter C++</a></h3><p>In 1983, several modifications and extensions had already been made to C with classes. In that year, the name "C++" was coined. Ever since then, the ++ suffix has become a synonym for object-orientation. (Bjarne Stroustrup could have made a fortune only by registering ++ as a trademark) It was also in that year that C++ was first used outside AT&T Labs. The number of users was doubling every few months -- and so was the number of compilers and extensions to the language.</p><h3> <a name="Heading4">The Late 1980s: Opening the Floodgates</a></h3><p>Between 1985 and 1989, C++ underwent a major reform. Protected members, protected inheritance, templates, and a somewhat controversial feature called multiple inheritance were added to the language. It was clear that C++ needed to become standardized.</p><h2> <a name="Heading5">ANSI Committee Established</a></h2><p>In 1989, the <i>American National Standards Institution</i> (<i>ANSI</i>) committee for the standardization of C++ was established. The official name of the committee was X3J16, and later it was changed to J16. Generally, standardization committees don't write a standard from scratch; rather, they adopt an existing de facto reference, and use it as their baseline. The ANSI C committee used <i>The C Programming Language</i> by Kernighan and Ritchie as a starting point. Likewise, the ANSI C++ committee used the <i>Annotated C++ Reference Manual</i> (ARM) by Ellis and Stroustrup as its base document. The ARM provided a clear and detailed starting point for the committee's work. The committee's policy was to not rush into establishing a half-baked standard that would become obsolete in a year or two. Instead, the policy was to allow the demands for changes to emerge from the users of the language, the C++ community. Nonetheless, the committee also initiated extensible modifications and changes to the language, such as <i>runtime type information</i> (RTTI) and the new cast notation. </p><h3> <a name="Heading6">Maturation</a></h3><p>By that time, hundreds of thousands of people were using the language. C++ compilers were available for almost every platform. New C++-based frameworks, such as MFC and OWL, had emerged. The committee had to face enormous pressure from several directions. Some organizations were advocating new features and extensions to the language that were borrowed from other object-oriented languages, while other parties strove to keep it as efficient as possible. On top of this, C++ had to retain its backward compatibility with C, including the support of eight different flavors for integral types, cumbersome pointer syntax, structs, unions, global functions, and many other features that don't exactly go hand in hand with object orientated programming. </p><h3> <a name="Heading7">International Standardization</a></h3><p>C++ standardization was a joint international endeavor in which national standardization bodies from all over the world were intensively involved. This is different from the standardization of C. C standardization was first carried out by ANSI as an American standard and was later adopted, with some modifications (mainly internationalization issues), as an international standard by the <i>International Standardization Organization</i> (<i>ISO</i>). The international venture of C++ guaranteed a worldwide acceptance of the standard, albeit at the price of somewhat more complicated procedures. Thus, the committee's meetings were actually joint meetings of both the ANSI working group and the ISO working group. Officially, the ANSI working group served as an advisor to ISO. Therefore, two votes were taken on every technical issue: an ANSI vote, to decide what the ANSI recommendation was, and a subsequent ISO vote, to actually make the decision. Some important changes were made in order to meet the criteria for ISO approval, including the addition of <tt>wchar_t</tt> as a built-in type, the templatization of the <tt>iostream</tt> library, the templatization of class <tt>string</tt>, and the introduction of the <i>locale library</i>, which encapsulates cultural-dependent differences. </p><h3> <a name="Heading8">Committee Drafts And Public Review</a></h3><p>The committee's initiatory task was to produce a draft of the standard, known as the Committee Draft (CD). For that purpose, the committee convened three times a year, one week at a time, in different places of the world. The first CD received several disapproving votes as well as many comments from ISO. The committee resolved these technical issues and addressed the comments in the second CD. The second CD was approved by ISO; however, there were still 5 "nay" votes and accompanying comments. Following the ISO balloting, the CD's were made available to the public. The public review process enabled C++ users from all over the world to comment on the proposed CD and point out contradictions and omissions. </p><h3> <a name="Heading9">Feature Freeze and Finalization</a></h3><p>After the approval of the second CD in November 1996, the committee's task was mainly to respond to the 5 "nay" votes and the accompanying comments and turn them into "aye" votes. The resultant document was the Final Draft International Standard, or the FDIS. At the meeting of the standardization committee in November, 1997 at Morristown, New Jersey, the FDIS was unanimously approved. In 1998, after a few minor changes, the FDIS was approved by ISO and became an international standard. In accordance with ISO rules, after it was approved, the Standard entered a freeze period of five years; during this time, the only modifications that are allowed are error fixes. People who find such defects can submit a Defect Report to the committee for consideration.</p><h2> <a name="Heading10"> C++ as Opposed to Other Object-Oriented Languages</a></h2>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -