Marshall Cline. Greg Lomow What kind of guidance is given in the answers to these FAQs?.. 5 the first edition? .. How should runtime errors be handled in C++?. . Does delete p delete the pointer p or the referent *p?. The first edition of the C++ FAQ addressed the why of C++, using the highly effective, concise, and a to-the-point question/answer format. In this Second Edition. Marshall P. Cline C++ FAQs 2nd Edition, Kindle Edition Moderators of the on -line C++ FAQ at c++, Marshall Cline, Greg Lomow, and Mike Girou.

Author: Akill Tojalar
Country: Finland
Language: English (Spanish)
Genre: Finance
Published (Last): 1 September 2007
Pages: 437
PDF File Size: 12.92 Mb
ePub File Size: 15.99 Mb
ISBN: 892-8-52597-727-2
Downloads: 31064
Price: Free* [*Free Regsitration Required]
Uploader: Yojinn

Register your product to gain access to bonus material or receive a coupon. This eBook includes the following formats, accessible from your Account page after purchase:. Marshxll The open industry format known for its reflowable content and usability on supported mobile devices.

This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

In this book, the authors concentrate on those issues most critical to the professional programmer’s work, and they present more explanatory material and examples than is possible on-line.

C++ FAQs, 2nd Edition | InformIT

These new features and technologies are iconed to help you quickly find what is new and different in this edition. Each question-and-answer section contains an overview of the problem and solution, fuller explanations of concepts, directions for proper use of language features, guidelines for best practices and practices to avoid, and plenty of working, stand-alone examples.

This edition is thoroughly cross-referenced and indexed for quick access. Get a value-added service!

Try out all the examples from this book at www. CodeSaw is a free online learning tool that allows you to experiment with live code from your book right in your browser. This code is provided marshaol its instructional value. It has been tested with care, but it is not guaranteed for any particular purpose.

The publisher and authors do not offer any warranties or representations, nor do they accept any liabilities with respect to this code. Click here to download the code. Click below for Sample Chapter related to this title: Section of a Class? What is the purpose of this chapter?

To explain what the book is all about, how it is related to the electronic FAQ and the first edition, and what conventions are used. This chapter discusses the purpose of the book and the conventions it follows.

This chapter also discusses our approach to FAQs and why you should buy this book if you have the first edition or have access to the electronic FAQ. Each FAQ provides specific guidance in the form of in-depth answers.

The word FAQs is pronounced like “facts. These FAQs aren’t necessarily questions people have asked; rather, they are the questions people should ask. Although we never say it publicly, most of these FAQs are based on dumb things we see people do on a fairly regular basis. We got tired of explaining the same fundamental notions over and over again and decided to write them down in this book.

This book is aimed at developers including programmers, architects, and designers. This book is not for beginners who are just learning to program since it assumes previous programming background. Familiarity with C wouldn’t hurt but is not absolutely necessary. Another reason for this approach is that the language is so large that it is hard for developers to understand what is relevant and how to apply it.


For example, inheritance is a powerful facility that can improve the clarity and extensibility of software, but it can also be abused in ways that result in expensive design errors.

The field of object-oriented technology is large, evolving, and heterogeneous. Under these circumstances, a guidebook is essential. These FAQs cover the latest innovations so that you don’t have to stumble around for years learning the same lessons others have already learned. The FAQs also expose incorrect and questionable practices. To be effective, programmers need to understand the language features and how the features of the language can be combined.

For example, pointer arithmetic and the is-a conversion see FAQ 2. Similar comments apply when combining overloading and overriding FAQ Explanations of language features, directions for using these features properly, and guidelines indicating programming practices to avoid. The FAQs can be divided into roughly three categories: Some of these answers deal with only a single language feature, while others explain how to use several different language features in concert.

Combining language features allows sophisticated designs that can simultaneously satisfy multiple technical requirements and business goals. FAQs that expose poor programming practices. The Internet version is currently updated and distributed by Marshall and is available through the news group comp.

This book has substantially more material than the electronic FAQ. Addison-Wesley decided to provide an expanded form of that information in book format.

This p.clinne covers a broader range of topics and goes into greater depth than the electronic FAQ. It provides deeper coverage of the key points with extensive new examples. Most of the programming examples are working, stand-alone programs, complete with their own mainall necessary include files, and so on. All examples have been compiled directly from the source text of the book; those that are complete programs have also been run.

Because the world has changed and you want to keep up with technology. The goal of this second edition is to bring you up to speed on all of these new developments while still keeping the pithy style and FAQ format that was so well received in the first edition. Finally, the second edition is much more self-contained than the first, with lots of syntax and semantics.

We’ve appreciated all your comments and suggestions and have tried to accommodate them wherever possible. The undecorated word inheritance means “public inheritance. Similarly the undecorated term derived class means “public derived class. The class madshall Base and Derived are used as hypothetical class names to illustrate the general relationship between a base class and one of its publicly derived marshal.

The term out-lined marshall indicates a function that is called via p.clinf normal CALL instruction. In contrast, when an inlined function is invoked, the compiler inserts the object code for that function at the point-of-call. The term remote ownership is used when an object contains a pointer to another object that the first object is responsible for deleting. The default destruction and copy semantics for objects that contain remote ownership are fqs, so explicit controls are needed.

To allow compilation while simplifying the presentation to the reader, examples that use the standard library have a line that says using namespace std. This dumping of the entire standard namespace is acceptable as a short-term conversion technique or as a pedagogical aid, but its use in production systems is controversial.



Most authorities recommend introducing class names as needed or using the std:: NULL is used rather than 0 to make the code more readable. Organizational standards and guidelines should be consulted before the reader continues this practice. The intrinsic data type bool is used, which has literal values true and false. For compilers that don’t have a built-in bool type, insert the following at the beginning of each example: Most compilers implement this correctly, but some do not.

Most examples use protected: In the real world, this is appropriate for most developers and edotion applications, but framework developers probably should not use protected: In general, framework developers should use private: Type names names of classes, structs, unions, enums, and typedefs start with a capital letter; preprocessor symbols are all capitals; all other identifiers start with a lowercase letter. Data member names and class-scoped enumerations end with a single underscore.

It is assumed that the file extensions. Some compilers use a different convention. The following priorities l.cline used in designing the examples: In other words, each example demonstrates one basic point or technique, is as short as possible, and, if possible, is a complete, working program.

C++ FAQs, 2nd Edition

The examples are not intended for plug-in reuse in industrial-strength settings because balancing the resultant subtle tradeoffs would conflict with these priorities. To avoid complicating the discussions with finding the optimal balance between the use of virtual and inline for member functions, virtual is used more often than strictly necessary see Fdition To achieve compactness, some member functions are defined in the class body even if they wouldn’t normally be inline or even if moving them down to the bottom of 22nd header file would improve specification see FAQ 6.

Uncalled functions are often left undefined. Some functions that are called are also undefined, since compactness is a higher priority than self-contained functionality. Also for compactness, examples are not wrapped in preprocessor symbols that prevent multiple expansions see FAQ 2. The examples put the public: This makes it easier for those who 2nv want to use the class as opposed to those who want to go in and change the internal implementation of the class.

Follow the Author

This is normally the right tradeoff since a class is normally used a lot more often than it is changed. In the real world, this is probably not a safe assumption, and you should be cautious.

Get unlimited day access to over 30, books about UX design, leadership, project management, teams, agile development, analytics, core programming, and so much more.

Add To My Wish List. Description Copyright Dimensions: What Is the Purpose of This Chapter? What Are the Basics of Main? What Are the Basics of Functions? What Are the Basics of Default Parameters? What Are the Basics of Stream Output? What Are the Basics of Stream Input? What Are the Basics of Defining a Class?