ine
Subject: C++ FAQ (#1 of 7)
Date: 6 Nov 1996 23:23:01 GMT
Summary: Please read this before posting to comp.lang.c++

Archive-name: C++-faq/part1
Posting-Frequency: monthly
URL: http://www.cerfnet.com/~mpcline/C++-FAQs-Lite/

AUTHOR: Marshall Cline / cline@parashift.com / Paradigm Shift, Inc. /
One Park St. / Norwood, NY 13668 / 315-353-6100 (voice) / 315-353-6110 (fax)

COPYRIGHT: This posting is part of "C++ FAQs Lite."  The entire "C++ FAQs Lite"
document is Copyright(C) 1991-96 Marshall P. Cline, Ph.D., cline@parashift.com.
All rights reserved.  Copying is permitted only under designated situations.
For details, see section [1].

NO WARRANTY: THIS WORK IS PROVIDED ON AN "AS IS" BASIS.  THE AUTHOR PROVIDES NO
WARRANTY WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK, INCLUDING
WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
PURPOSE.

C++-FAQs-Lite != C++-FAQs-Book: This document, C++ FAQs Lite, is not the same
as the C++ FAQs Book.  The book (C++ FAQs, Cline and Lomow, Addison-Wesley) is
500% larger than this document, and is available in bookstores.  For details,
see section [3].

==============================================================================

This "raw text" document was mechanically produced from the HTML version at:
    USA:.http://www.cerfnet.com/~mpcline/C++-FAQs-Lite/
    USA-2:.http://vpihe1.phys.vt.edu/~lockhart/computer/cpp/index.html
    U.K.:.http://www.cs.bham.ac.uk/~jdm/CPP/index.html
    Germany:.http://www.informatik.uni-konstanz.de/~kuehl/cpp/cppfaq.htm
    Finland:.http://www.utu.fi/~sisasa/oasis/cppfaq/
    Taiwan:.http://www.cis.nctu.edu.tw/c++/C++FAQ-English/

If you have a Web browser, you probably want to read one of the above HTML
sites instead of this document because:
 * The HTML version has many hyperlinked cross references.
 * The HTML version is MUCH easier to read than this "raw text" version.
 * The HTML version is updated more regularly than this "monthly posting".

==============================================================================

If you're interested in a specific topic...

The extensive subject index is a big help if you're looking for a specific
topic in C++ FAQs Lite.

==============================================================================

If you're only interested in the recent changes...

You can search for "[Recently" to find the 11 FAQs that are new or changed for
the 11/96 and 10/96 releases.  Also you can search for "[NEW!]" or
"[UPDATED!]".  This is a big help if you want to see what's changed since the
last time you read C++ FAQs Lite.  The HTML version (see URLs above) "chains"
these together using hyper-links.

==============================================================================

Table of Contents:

 * [1] Copying permissions
 * [2] On-line sites that distribute this document
 * [3] C++-FAQs-Book versus C++-FAQs-Lite
 * [4] Recent changes to this document
 * [5] Netiquette when posting to comp.lang.c++
 * [6] Management issues
 * [7] Classes and objects
 * [8] References
 * [9] Inline functions
 * [10] Constructors
 * [11] Destructors
 * [12] Assignment operators
 * [13] Operator overloading
 * [14] Friends
 * [15] Input/output via <iostream.h> and <stdio.h>
 * [16] Freestore management
 * [17] Exceptions and error handling
 * [18] Const correctness
 * [19] Inheritance -- basics
 * [20] Inheritance -- virtual functions
 * [21] Inheritance -- proper inheritance and substitutability
 * [22] Inheritance -- abstract base classes (ABCs)
 * [23] Inheritance -- what your mother never told you
 * [24] Inheritance -- private and protected inheritance
 * [25] Coding standards
 * [26] Learning OO/C++
 * [27] Learning C++ if you already know Smalltalk
 * [28] Reference and value semantics
 * [29] How to mix C and C++
 * [30] Pointers to member functions
 * [31] Container classes and templates
 * [32] Class libraries
 * [33] Compiler dependencies
 * [34] Miscellaneous technical issues
 * [35] Miscellaneous environmental issues

==============================================================================

Subject Index

"A"
 * ABC (see also Inheritance) ... [22.2], [22.3]
 * Access rules
   - protected: and private: inheritance ... [24.6]
   - protected: and private: members ... [19.5], [19.6]
 * Acronyms ... [5.1]
 * Ada vs. C++ ... [6.4]
 * Aliasing
   - Aliasing of const and non-const pointers ... [18.9], [18.11], [18.12],
     [18.13]
   - References are aliases for objects ... [8.1], [8.5]
 * All Terrain Vehicle (ATV) ... [27.5]
 * ANSI ... [6.12]
   - ANSI-C ... [6.10]
   - ANSI-C++ committee "X3J16" ... [6.11], [27.1]
 * Arity ... [13.7]
 * Arrays
   - Arrays are evil ... [10.5], [13.6], [17.3], [21.5]
   - Specifying length at runtime ... [16.16]
 * Assignment operator ... [12]
   - Check for self-assignment ... [22.5], [25.7]
   - Return *this ... [25.7]
   - Self-assignment ... [12.1], [12.2], [12.3]
   - Use const in parameter ... [25.7]
 * Associative array (see also STL) ... [31.1]
 * Associativity ... [13.7]
 * Author (see also C++ FAQs Lite) ... [1.1]
 * auto_ptr ... [17.2]

"B"
 * Backtracking ... [5.3]
 * bad_alloc (see also Freestore) ... [16.5], [16.6]
 * Bag of Apple vs. of Fruit ... [21.3]
 * Base class ... [19.3]
 * Beautifier, Code (see Pretty printing) ... [35.2]
 * Big Three, Law of ... [22.5], [25.7]
 * Binary compatibility between vendors ... [33.6]
 * Binding: Static vs. dynamic ... [20.2], [20.3]
 * Book (see C++ FAQs Book) ... [3]
 * Books on C++ ... [26]
 * BTW (Acronym) ... [5.1]
 * Business criteria dominate technical criteria ... [6.4]

"C"
 * C++2LaTeX (see Pretty printing) ... [35.2]
 * C++ books ... [26]
 * C++ FAQs Book ... [3]
   - Available only in bookstores ... [3.3]
   - Is 500% bigger than this Lite document ... [3.4]
   - ISBN ... [3.1]
   - Not same as the on-line ("Lite") document ... [3.2]
 * C++ FAQs Lite ... [3]
   - Author ... [1.1]
   - Availability on-line ... [2]
   - Book is 500% bigger ... [3.4]
   - Chinese translation ... [2.4]
   - Copy permissions ... [1]
   - Copying permissions ... [1.5]
   - Copyright notice ... [1.2]
   - Mirror WWW sites ... [2.1]
   - No Warranty ... [1.3]
   - Not same as C++ FAQs Book ... [1.4], [3.2]
   - Raw text version ... [2.3]
   - Recent changes ... [4]
 * C language
   - Accessing C++ data members from C ... [29.9]
   - C++ backward compatibility ... [6.10]
   - C++ is higher level than C ... [29.10]
   - C vs. C++ ... [6.4]
   - Calling C from C++ ... [29.5]
   - Calling C++ from C ... [29.6]
   - Coding standards different from C++ ... [25.3]
   - Common linker errors ... [23.4], [29.7]
   - __cplusplus ... [29.4]
   - extern C ... [29.3]
   - Including C headers ... [29.2], [29.3], [29.4]
   - Linking must be directed by C++ ... [29.1]
   - main() must be compiled using C++ ... [29.1]
   - Mixing C and C++ code ... [29]
   - Newsgroup comp.lang.c ... [5.8]
   - Not an efficient way to learn OO/C++ ... [26.2]
   - Passing C++ objects to C code ... [29.8], [29.9]
   - static at file-scope ... [7.5]
 * C++ Libraries FAQ ... [32.8]
 * Changes to this document (see also C++ FAQs Lite) ... [4]
 * char*: Use a string-like class instead ... [13.6], [17.3]
 * Chinese translation of this document ... [2.4]
 * Circles vs. Ellipses ... [21.6], [21.7], [21.8], [21.9]
 * class ... [7.1], [7.8]
 * clone() methods ... [16.20], [20.5], [22.5]
 * Coding standards ... [25]
   - Assignment operators check assignment-to-self ... [12.1], [25.7]
   - Assignment operators return *this ... [25.7]
   - Assignment operators use const ... [25.7]
   - Avoid arrays whenever possible ... [21.5]
   - Avoid dynamically typed libraries ... [32.4]
   - Avoid global variables ... [34.2]
   - Avoid hiding nested identifiers ... [34.2]
   - Bloodshed, Jihads, and Heat vs. Light ... [25.1]
   - Coding standards are never sufficient ... [25.2]
   - Coding standards are sometimes necessary ... [25.2]
   - Copy constructors use const ... [25.7]
   - Declare near first use ... [25.4]
   - Design classes from the outside-in ... [13.9]
   - Don't base C++ standards on C standards ... [25.3]
   - Don't test for NULL after new ... [16.5]
   - Don't test for NULL before delete ... [16.7]
   - Explicitly calling destructors (Don't!) ... [11.5], [11.6], [11.9]
   - Explicitly calling destructors (OK sometimes) ... [11.10]
   - Header filename extensions ... [25.6]
   - Identifier naming conventions ... [25.8]
   - Initialization lists ... [25.7]
   - Law of the Big Three ... [25.7]
   - Operator overloading ... [25.7]
   - Source filename extensions ... [25.5]
   - static at file-scope (Don't!) ... [7.5]
   - The Ellemtel coding guidelines ... [25.9]
   - Todd Hoff's coding guidelines ... [25.9]
   - Use a string object rather than a char* ... [13.6], [17.3]
   - Use delete[] for arrays ... [16.11]
   - virtual destructor coding standard ... [25.7]
 * Combinations ... [5.3]
 * Committee Draft (CD) for ANSI/ISO-C++ ... [6.12]
 * Compatibility, Binary ... [33.6]
 * Compiler dependencies ... [33], [33.3]
 * Composition
   - Benefits compared to freestore ... [28.4], [28.5]
   - Compared with private inheritance ... [24.2]
   - Criteria for composition vs. private inheritance ... [24.3]
   - Inlining virtual functions ... [28.5], [28.6]
 * const_cast ... [18.10]
 * Const correctness ... [18], [18.1]
   - A form of type safety ... [18.2]
   - Aliasing of const and non-const pointers ... [18.12]
   - Coding standards concerning ... [25.7], [25.7]
   - const_cast ... [18.10], [18.11]
   - const member functions ... [18.9]
   - Fred& const x is nonsense ... [18.7]
   - Fred const& x -- use const Fred& x instead ... [18.8]
   - Immutable (const) pointers ... [18.5]
   - mutable ... [18.10]
   - Pointer-to-const ... [18.4], [18.5]
   - Pointer-to-const aliasing ... [18.13]
   - Reference-to-const ... [18.6]
   - Retrofitting const correctness is hard ... [18.3]
 * Constructors ... [10], [16.9]
   - Build objects from dust ... [10.1]
   - Calling a virtual from ... [23.1]
   - Calling another constructor ... [10.3]
   - Coding standards re. copy constructor ... [25.7]
   - Default constructors ... [10.4], [10.5]
   - Init methods ... [10.3]
   - Initialization coding standard ... [25.7]
   - Member objects should be self-managing ... [17.2]
   - Named Constructor Idiom ... [10.6], [16.17], [16.20]
   - Throwing exceptions ... [17.1]
   - Virtual Constructor Idiom ... [16.20], [20.5], [22.5]
 * Containers ... [31]
   - Container of Thing vs. of Anything ... [21.4]
   - Heterogeneous ... [31.2]
   - Iterators ... [31.3]
 * Copy constructors
   - Should use const ... [25.7]
 * Copy on write (see Reference counting) ... [16.19], [16.20]
 * Copy semantics (see also Value semantics) ... [28.1]
 * Copying permissions (see also C++ FAQs Lite) ... [1], [1.5]
 * Copyright notice (see also C++ FAQs Lite) ... [1.2]
 * Crash at runtime without any warning ... [11.5], [11.6], [16.2], [16.4],
   [16.11], [16.12], [17.3], [20.4], [21.1], [21.4], [21.5], [34.2]
 * create() methods (see Named Constructor Idiom) ... [10.6], [16.17], [16.20]
 * Ctor (see also Constructors) ... [10]

"D"
 * Dangerous programming practices ... [11.5], [11.6], [11.10], [13.6], [16.2],
   [16.4], [16.11], [16.12], [17.3], [20.4], [21.1], [21.4], [21.5], [23.3],
   [34.2]
 * Declarations
   - Declare near first use ... [25.4]
   - List x(); declares a function, not an object ... [10.2]
 * Decompiling executables back into C++ source code ... [33.2]
 * Default parameters ... [10.3]
 * #define macros (see also Inline functions) ... [9.1], [9.3], [26.2], [27.3],
   [29.4], [30.5], [30.6]
 * delete ... [16.1]
   - delete p actually deletes *p, not p ... [16.1]
   - delete this ... [16.14]
   - delete[] uses magic ... [16.13], [33.4], [33.5]
   - delete[] vs. delete ... [16.11]
   - delete[] vs. delete for builtin types ... [16.12]
   - Deleting an array with delete[] ... [16.10]
   - Mixing with malloc() ... [16.2]
 * Derived classes ... [19.3]
   - Can access protected parts of Base ... [19.7]
   - Can't access private parts of Base ... [19.6]
   - Derived* to Base* conversion ... [19.4], [21.2]
   - Derived** to Base** conversion (invalid) ... [21.2]
   - Derived* to private Base* conversion (invalid) ... [24.4]
 * Design books ... [26.7]
 * Destructors ... [11], [16.8], [16.13], [33.4], [33.5]
   - Base class subobjects are automagically destructed ... [11.12]
   - Calling a virtual from ... [23.1]
   - Can't be overloaded ... [11.4]
   - Coding standards concerning ... [25.7]
   - Controlling lifetimes of locals ... [11.6], [11.7], [11.8]
   - Explicitly calling them (Don't!) ... [11.5], [11.6], [11.9]
   - Explicitly calling them (OK sometimes) ... [11.10]
   - Last rites ... [11.1]
   - Member objects are automagically destructed ... [11.11]
   - Order of destruction for array elements ... [11.3]
   - Order of destruction for locals ... [11.2]
   - virtual destructor coding standard ... [20.4]
 * Dijkstra ... [5.3]
 * Directory separator: use "/", not "\" ... [15.8], [34.1]
 * Downloading
   - HTML version of this document ... [2.1], [2.2]
   - Raw text version of this document ... [2.3]
 * Dtor (see also Destructors) ... [11]
 * Dynamic
   - Dynamic binding ... [6.7], [20.2], [20.3]
   - dynamic_cast ... [31.2]
   - Dynamic length arrays ... [16.16]
   - Dynamic typing ... [20.2], [27.2], [27.3], [32.4], [32.5]

"E"
 * Ellemtel coding guidelines (see also Coding standards) ... [25.9]
 * Ellipses vs. Circles ... [21.6], [21.7], [21.8], [21.9]
 * Encapsulation ... [6.7], [7]
   - Definition ... [7.4]
   - Hides stuff from code, not from people ... [7.6]
   - Not necessarily violated by friends ... [14.2]
   - Security vs. Encapsulation ... [7.7]
 * Equation parsing in C++ ... [5.3]
 * Etiquette (see also Netiquette) ... [5]
 * Exceptions ... [17]
   - Constructors can throw exceptions ... [17.1]
   - Example of throw; to re-throw current exception ... [16.9], [17.3],
     [33.4], [33.5]
   - Example of try ... catch ... [16.9], [17.3], [33.4], [33.5]
   - Member objects should be self-managing ... [17.2]
 * Executables -- decompiling back to C++ source code ... [33.2]
 * extern C (see also C language) ... [29], [29.3]

"F"
 * Features of C++ from a business perspective ... [6.7]
 * Filenames
   - Extensions for header files ... [25.6]
   - Extensions for source code files ... [25.5]
   - Using "/" rather than "\" for directories ... [15.8], [34.1]
 * find_if ... [32.2]
 * Floating point ... [34.5], [35.5]
 * for loop ... [34.2]
 * FORTRAN vs. C++ ... [6.4]
 * free() (see also Freestore) ... [16.2]
 * Freestore ... [16]
   - Allocating an array with new T[n] ... [16.10]
   - Automating a NULL test ... [16.6]
   - bad_alloc ... [16.5], [16.6]
   - delete handles NULL automatically ... [16.7]
   - delete has two steps ... [16.8]
   - delete this ... [16.14]
   - delete[] uses magic ... [16.13], [33.4], [33.5]
   - delete[] vs. delete ... [16.11]
   - delete[] vs. delete for builtin types ... [16.12]
   - Deleting an array with delete[] ... [16.10]
   - Mixing malloc() and delete ... [16.2]
   - Mixing new and free() ... [16.2]
   - Multi-dimensional arrays ... [16.15]
   - new has two steps ... [16.9]
   - new never returns NULL ... [16.5]
   - Placement new ... [11.10], [16.9]
   - Prohibiting local objects ... [16.17]
   - realloc() ... [16.4]
   - Reference counting ... [16.18], [16.19], [16.20]
   - Runtime costs of heap ... [28.4], [28.5]
   - set_new_handler ... [16.6]
   - Why use new rather than malloc() ... [16.3]
 * Friends ... [14]
   - Choosing between members and friends ... [14.5]
   - Definition of friend ... [14.1]
   - friend doesn't necessarily violate encapsulation ... [14.2]
   - Friendship privileges aren't inherited ... [14.4]
   - Friendship privileges aren't transitive ... [14.4]
   - istream operator>> ... [15.5]
   - ostream operator<< ... [15.4]
   - ostream operator<< (virtual) ... [15.6]
   - Pros and cons of friends ... [14.3]
   - Virtual Friend Function Idiom ... [14.3], [15.6]
 * From: line of a posting (see also Netiquette) ... [5.4]
 * FTP sites
   - butler.hpl.hp.com ... [32.1]
   - ftp.cs.rpi.edu ... [32.1]
   - ftp.maths.warwick.ac.uk ... [6.12]
   - ftpt.su.edu.au ... [6.12]
   - research.att.com ... [6.12]
   - rtfm.mit.edu ... [5.9]
   - www.cs.rpi.edu ... [32.1]
   - www.maths.warwick.ac.uk ... [32.1]
 * FWIW (Acronym) ... [5.1]
 * FYI (Acronym) ... [5.1]

"G"
 * Generalization (see also Inheritance) ... [19.3]
 * Genericity (see also Templates) ... [31.8]
 * Global variables: Just Say No! ... [34.2]
 * GNU
   - emacs ... [35.3]
   - g++ ... [5.8]
 * Graphics ... [5.8]
 * Growth of C++ ... [6.5], [6.7]

"H"
 * Has-a (see also Composition) ... [19.2], [24.2]
 * Header filename extensions ... [25.6]
 * Heap-sort ... [5.3]
 * Heat vs. light ... [25.1]
 * Heterogeneous containers ... [31.2]
 * Hiding inherited public features ... [21.1], [21.6], [21.7], [21.8]
 * Hiding rule ... [23.3]
 * Homework problems ... [5.2], [5.3]
 * Homogeneous containers ... [31.2]
 * Hostility ... [29.10]
 * How to learn OO/C++ ... [26]
 * Hybrid OO programming languages ... [26.3]
 * Hype ... [6.3]

"I"
 * Idioms
   - Named Constructor Idiom ... [10.6], [16.17], [16.20]
   - Virtual Constructor Idiom ... [16.20], [20.5], [22.5]
   - Virtual Friend Function Idiom ... [15.6]
 * IMHO (Acronym) ... [5.1]
 * Immutable (const) pointers ... [18.5]
 * IMNSHO (Acronym) ... [5.1]
 * IMO (Acronym) ... [5.1]
 * Imperfect programming languages ... [6.2]
 * #include
   - Including C headers ... [29.2], [29.3], [29.4]
   - Use forward slash "/", not backslash "\" ... [34.1]
 * indent (see Pretty printing) ... [35.2]
 * Indirection, Extra layers of ... [28.5]
 * Infix operators ... [5.3]
 * Inheritance ... [6.7], [19], [20], [21], [22], [23]
   - Abstract base classes (ABCs) ... [22], [22.2], [22.3]
   - Access of private: by derived ... [19.6]
   - Access of protected: and private: ... [19.5]
   - Access of protected: by derived ... [19.7]
   - Array of Derived vs. of Base ... [21.4]
   - Calling virtuals from constructors ... [23.1]
   - Circle vs. Ellipse ... [21.6], [21.7], [21.8], [21.9]
   - Derived* to Base* conversion ... [19.4], [21.2]
   - Derived** to Base** conversion (invalid) ... [21.2]
   - Derived* to private Base* conversion (invalid) ... [24.4]
   - Differences between C++ and Smalltalk inheritance ... [27.4]
   - Hiding inherited public features ... [21.1]
   - Hiding rule ... [23.3]
   - How to code inheritance ... [19.3]
   - Importance of inheritance ... [19.1]
   - Is-a-kind-of ... [19.2]
   - Multiple inheritance ... [6.7], [11.12], [24.2], [29.8], [29.9], [33.6],
     [33.9]
   - Old code calls new code ... [6.9]
   - Parking-lot of Car vs. of Vehicle ... [21.3]
   - private inheritance ... [24], [24.1]
   - private inheritance access rules ... [24.6]
   - private inheritance vs. composition ... [24.2], [24.3]
   - protected inheritance access rules ... [24.6]
   - protected vs. private inheritance ... [24.5]
   - Pure virtual functions ... [22.4]
   - Redefining non-virtuals ... [23.2]
   - Smalltalk differences ... [27.5]
   - Specification device ... [19.2]
   - virtual constructors ... [16.20], [20.5], [22.5]
   - virtual data ... [28.2], [28.3]
   - virtual destructor coding standard ... [20.4]
   - virtual functions ... [20.1]
   - virtual functions are central to OO ... [6.8]
   - virtual inheritance ... [11.12], [29.8], [29.9], [33.6], [33.9]
   - What your Mother didn't tell you ... [23]
   - When to use inheritance ... [19.2]
 * Initialization lists (see also Coding standards) ... [25.7]
 * Initialization of a static member datum ... [10.7], [10.8]
 * Inline functions ... [9]
   - Better than #define macros ... [9.3]
   - Can degrade performance ... [9.7]
   - Defined outside class body ... [9.5]
   - Defined within class body ... [9.6]
   - Inlining virtual functions ... [28.5], [28.6]
   - Like a #define macro ... [9.1]
   - Member functions ... [9.5]
   - Non-member functions ... [9.4]
   - Safety without loss of speed ... [6.7], [9.2]
 * Input/output ... [15]
   - Binary mode on MS-DOS ... [15.7]
   - istream and eof ... [15.2]
   - istream operator>> ... [15.5]
   - istream remembers bad state ... [15.3]
   - ostream operator<< ... [15.4]
   - ostream operator<< (virtual) ... [15.6]
 * Inspector methods ... [18.9]
 * Interfaces
   - A simplified view in the user's vocabulary ... [7.3]
   - Abstract base classes (ABCs) ... [22.2]
   - Design interfaces from the outside-in ... [13.9]
   - Goal of interface design ... [7.4]
   - More valuable than implementation ... [22.1]
   - protected interface ... [19.7]
   - Separate from implementation ... [22.2]
 * Intuition isn't always correct ... [21.3], [21.4], [21.6], [21.7], [21.8]
 * iostream.h ... [15.1]
 * Is-a-kind-of (see also Inheritance) ... [19.2]
 * ISO ... [6.12]
   - ISO-C ... [6.10]
   - ISO-C++ committee "WG21" ... [6.11]
 * Iterators ... [31.3]

"J"
 * Java vs. C++ ... [6.4]

"K"
 * Kind-of (see also Inheritance) ... [19.2]
 * Kruskal ... [5.3]

"L"
 * Language wars ... [6.4]
 * Large executables ... [32.7], [33.7]
 * Last rites (see also Destructors) ... [11.1]
 * LaTeX
   - C++2LaTeX pretty printer ... [35.2]
   - Macros for "C++" ... [35.1]
 * Law of the Big Three ... [22.5], [25.7]
 * Layer of indirection ... [28.5]
 * Learning OO/C++ ... [26]
 * Learning OO/C++
   - How long does it take ... [6.6]
   - No need to learn C first ... [26.2]
   - No need to learn Smalltalk first ... [26.3]
 * Legality books on C++ ... [26.4], [26.6]
 * Length of time needed to learn OO/C++ ... [6.6]
 * Libraries FAQ ... [32.8]
 * Libraries ... [32]
   - Dynamically typed C++ libraries ... [32.4], [32.5]
   - Large executables ... [32.7], [33.7]
   - Numerical Recepies ... [32.6]
   - STL ... [32.1], [32.3]
 * Lifetime of objects
   - Controlling lifetime of locals ... [11.6], [11.7], [11.8]
   - In heterogeneous containers ... [31.2]
   - New rule for for loop variables ... [34.2]
   - Order of destruction for array elements ... [11.3]
   - Order of destruction for locals ... [11.2]
   - Register liveness ... [28.5]
   - Using friend classes to achieve separate lifetimes ... [14.2]
 * Linker errors ... [10.8], [23.4], [29.7], [35.5]

"M"
 * malloc()
   - (See also Freestore) ... [16.2]
   - Why new is preferred over malloc() ... [16.3]
 * Managerial issues ... [6]
   - Business-centricity vs. Techno-centricity ... [6.4]
   - C++ is a practical tool ... [6.1]
   - C++ is not a perfect tool ... [6.2]
   - Growth of C++ ... [6.5]
   - Length of time needed to learn OO/C++ ... [6.6]
   - Some advantages of OO ... [6.3]
   - Standardization of C++ ... [6.11], [6.12]
 * map<Key,Value> (see also STL) ... [31.1]
 * Maseratti ... [27.5]
 * Matrix subscript operator ... [13.8]
 * Mentoring ... [6.6], [26.1]
 * Merge-sort ... [5.3]
 * MFC ... [33.1]
 * Microsoft Windows ... [5.8], [15.7], [35.4]
 * Minimum Spanning Trees in C++ ... [5.3]
 * Mirror sites (see also This document) ... [2]
 * Mixing
   - Mixing C and C++ code (see also C language) ... [29]
   - Mixing malloc() and delete ... [16.2]
   - Mixing new and free() ... [16.2]
 * Monolithic class hierarchies ... [32.4], [32.5]
 * Morality books on C++ ... [26.4], [26.5]
 * MS-DOS ... [5.8], [15.7], [35.4]
 * Multi-dimensional arrays ... [16.15]
 * Multiple
   - Multiple encapsulated instances ... [6.7], [7.5], [31.3]
   - Multiple inheritance ... [6.7], [11.12], [24.2], [29.8], [29.9], [33.6],
     [33.9]
 * mutable ... [18.10]
 * Mutator methods ... [18.9]
 * MYOB (Acronym) ... [5.1]

"N"
 * Named Constructor Idiom ... [10.6], [16.17], [16.20]
 * Netiquette ... [5]
   - From: line of a posting ... [5.4]
   - General netiquette ... [5.4]
   - Getting and reading other FAQs ... [5.9]
   - Posting code ... [5.7]
   - Reply-to: line of a posting ... [5.4]
   - Selecting an appropriate newsgroup ... [5.8]
   - Subject: line of a posting ... [5.6]
 * new
   - Advantages over malloc() ... [16.3]
   - Allocating an array with new T[n] ... [16.10]
   - Mixing with free() ... [16.2]
   - (See also Freestore) ... [16.1]
 * New handler (see also Freestore) ... [16.6]
 * Newsgroups
   - comp.graphics ... [5.8]
   - comp.lang.c ... [5.8]
   - comp.lang.c++ ... [5.8]
   - comp.lang.c++.moderated ... [5.8]
   - comp.object ... [5.8]
   - comp.os.ms-windows.programmer.misc ... [5.8]
   - comp.os.ms-windows.programmer.tools ... [5.8]
   - comp.os.msdos.programmer ... [5.8], [35.4]
   - comp.os.msdos.programmer.turbovision ... [5.8]
   - comp.programming ... [5.8]
   - comp.sources.wanted ... [5.8]
   - comp.std.c++ ... [5.8]
   - comp.sys.mac.oop.* ... [5.8]
   - comp.sys.mac.programmer.* ... [5.8]
   - comp.unix.programmer ... [5.8], [35.4]
   - comp.unix.solaris ... [5.8]
   - comp.windows.ms.programmer ... [35.4]
   - gnu.g++.bug ... [5.8]
   - gnu.g++.help ... [5.8]
 * NIHCL (National Institute of Heath Class Library) ... [32.5]
 * No Warranty (see also C++ FAQs Lite) ... [1.3]
 * Nuclear submarine ... [21.2]
 * NULL ... [16.5], [16.6]
 * Numerical Recepies code ... [32.6]

"O"
 * Object ... [7.2]
 * Object-oriented: So what? ... [6.3]
 * Old code calls new code ... [6.9]
 * OO design books ... [26.7]
 * Operator overloading ... [6.7], [13]
   - Assignment operator ... [12], [22.5]
   - Can't invent new operators ... [13.7]
   - Can't replace behavior on builtins ... [13.6]
   - Coding standards ... [25.7]
   - Does help the users of a class ... [13.2]
   - Does not help the developer of a class ... [13.4]
   - Examples ... [13.3]
   - operator!= ... [13.9]
   - operator() ... [13.8]
   - operator++ ... [13.9]
   - operator[] ... [13.8]
   - operator delete(void*) ... [16.8], [16.11]
   - operator delete[](void*) ... [16.11]
   - operator* (dereference operator) ... [13.9]
   - operator>> (istream input) ... [15.5]
   - operator new(size_t) ... [16.9]
   - operator<< (ostream output) ... [15.4]
   - operator<< (ostream output; virtual) ... [15.6]
   - Purpose of operator overloading ... [13.1]
   - Self-assignment ... [12.1], [12.2], [12.3]
   - Which operators can be overloaded ... [13.5]
 * Optimization
   - const_cast ... [18.11]
 * OS/2 ... [15.7]
 * OTOH (Acronym) ... [5.1]
 * Overloading
   - Can't overload by return type ... [34.3]
   - Operators (see Operator overloading) ... [6.7]

"P"
 * Paradigm shifts ... [6.6], [29.10]
 * Parameterized types (see also Templates) ... [31.7]
 * Parking lots ... [21.3]
 * Part-of (see also Composition) ... [19.2], [24.2]
 * Pascal vs. C++ ... [6.4]
 * Passing parameters
   - By pointer ... [8.1]
   - By reference ... [8.1], [28.8]
   - By value ... [28.8]
 * Perfect programming languages ... [6.2]
 * Permissions to copy this document ... [1]
 * Permutations ... [5.3]
 * Persistence ... [32.4], [32.5], [34.4]
 * Placement new ... [16.9]
 * Pointer semantics (see also Reference semantics) ... [28.1]
 * Pointer-to-const ... [18.4], [18.5], [18.13]
 * Pointer to function (see Pointer to member) ... [30.1]
 * Pointer to member ... [30]
   - Address of a C++ method ... [30.4]
   - Array of pointer-to-member ... [30.6]
   - Contrast to pointer-to-function ... [30.1]
   - Converting to pointer-to-function ... [30.2], [30.3]
   - Passing as pointer-to-function ... [30.2]
 * Polymorphism ... [6.7]
 * Postfix operators ... [5.3]
 * Posting code (see also Netiquette) ... [5.7]
 * Pragmatics ... [6.1]
 * Precidence ... [13.7]
 * Prepare to die! (see also Destructors) ... [11.1]
 * Pretty printing
   - C++2LaTeX ... [35.2]
   - C-Clearly ... [35.2]
   - GNU indent ... [35.2]
   - tgrind ... [35.2]
 * Prim ... [5.3]
 * private inheritance ... [24], [24.1]
   - Access rules ... [24.6]
   - Compared with composition ... [24.2]
   - Criteria for private inheritance vs. composition ... [24.3]
   - Derived* to private Base* conversion (invalid) ... [24.4]
   - private vs. protected inheritance ... [24.5]
 * private: members ... [19.5], [19.6]
 * Proficiency in OO/C++: How long does it take ... [6.6]
 * protected inheritance
   - Access rules ... [24.6]
   - protected vs. private inheritance ... [24.5]
 * protected: members ... [19.5]
   - The protected: interface ... [19.7]
 * public: inheritance ... [19], [20], [21], [22], [23]
 * public: members ... [19.5]
   - The public: interface ... [19.7]
 * Pure OO programming languages ... [26.3]
 * Pure virtual functions ... [22.3], [22.4]

"Q"
 * Quick-sort ... [5.3]

"R"
 * Raw text version of this document ... [2.3]
 * realloc() (see also Freestore) ... [16.4]
 * Recent changes to this document (see also C++ FAQs Lite) ... [4]
 * Redefining non-virtuals ... [23.2]
 * Reference counting
   - Copy on write ... [16.19], [16.20]
   - Pointer semantics ... [16.18]
   - Reference semantics ... [16.19]
   - Reference semantics for a hierarchy ... [16.20]
 * Reference semantics ... [28], [28.7], [28.8]
 * References ... [8]
   - Assigning a reference ... [8.2]
   - References to const ... [18.1], [18.6]
   - References vs. pointers ... [8.5]
   - Reseating a reference ... [8.4], [18.7], [18.8]
   - Returning a reference ... [8.3]
 * Reply-to: line of a posting (see also Netiquette) ... [5.4]
 * Return type ... [34.3]
 * RTFM (Acronym) ... [5.1]
 * rtfm.mit.edu ... [5.9]
 * Runtime crashes without any warning ... [11.5], [11.6], [16.2], [16.4],
   [16.11], [16.12], [17.3], [20.4], [21.1], [21.4], [21.5], [34.2]

"S"
 * Security vs. Encapsulation (see also Encapsulation) ... [7.7]
 * Self-assignment ... [12.1], [12.2], [12.3], [25.7]
 * Self-cleaning member objects ... [17.2]
 * set_new_handler (see also Freestore) ... [16.6]
 * Short-courses (one 40 hour workweek) ... [6.6]
 * Shortest path in C++ ... [5.3]
 * Smalltalk ... [27]
   - Differences with C++ ... [27.1]
   - Dynamic type checking ... [27.2]
   - Inheritance differences ... [27.4], [27.5]
   - Language wars vs. C++ ... [6.4]
   - Not an efficient way to learn OO/C++ ... [26.3]
 * Smart pointers ... [13.3], [16.18], [17.2]
 * SO (Acronym) ... [5.1]
 * Solaris ... [5.8]
 * Sorting in C++ ... [5.3]
 * Source filename extensions ... [25.5]
 * Spanning Trees in C++ ... [5.3]
 * Specialization (see also Inheritance) ... [19.3]
 * Standardization issues ... [5.8], [6.11], [6.12], [27.1]
 * Static
   - Common linker errors due to static data members ... [10.8]
   - Define static data members explicitly ... [10.7], [10.8]
   - Named Constructor Idiom using static ... [10.6], [16.17], [16.20]
   - static at file-scope (Don't!) ... [7.5]
   - Static binding ... [20.2], [20.3]
   - static create() methods ... [10.6], [16.17], [16.20]
   - Static typing ... [20.2], [27.2], [27.3]
 * Status bar with MFC ... [33.1]
 * stdio.h ... [15.1]
 * STL ... [32.2]
   - Access to on-line help ... [32.3]
   - FTP sites ... [32.1]
   - map<Key,Value> ... [31.1]
   - vector<T> ... [10.5], [16.16], [21.4], [21.5], [32.2]
 * string: Better than char* ... [13.6], [17.3]
 * struct ... [7.1], [7.8]
 * Style guidelines (see Coding standards) ... [25]
 * Subclass
   - See also Inheritance ... [19.3]
   - Subclasses that aren't subtypes ... [27.5]
 * Subject: line of a posting (see also Netiquette) ... [5.6]
 * Submarines, Nuclear ... [21.2]
 * Subscript operator for Matrix ... [13.8]
 * Substitutability ... [21.3], [21.4], [21.6], [21.7], [21.8]
 * Subtypes that aren't subclasses ... [27.5]
 * Superclass (see also Inheritance) ... [19.3]
 * Syntactic sugar ... [13.1]

"T"
 * .tar.Z (see Downloading) ... [2.2]
 * Templates ... [31]
   - Basics of templates ... [31.4]
   - Class template is a family of classes ... [31.6]
   - Function template is a family of functions ... [31.5]
   - Genericity ... [31.8]
   - Parameterized types ... [31.7]
 * TeX macros for "C++" ... [35.1]
 * tgrind (see Pretty printing) ... [35.2]
 * This document (see also C++ FAQs Lite) ... [3]
 * throw ... [16.5], [16.6]
 * To-the-power-of operator** (Can't!) ... [13.7]
 * Todd Hoff's coding guidelines (see also Coding standards) ... [25.9]
 * Training ... [6.6]
 * Transitivity ... [14.4]
 * Type safety
   - Comparison with Smalltalk ... [27.2]
   - Const correctness ... [18.2]
   - Static vs. dynamic typing ... [20.2]
 * typeid() ... [31.2]

"U"
 * Uncompiling executables back into C++ source code ... [33.2]
 * Unix ... [5.8], [35.4]
 * Unresolved external (see also Linker errors) ... [23.4]
 * Usenet newsgroups (see also Newsgroups) ... [5.8]

"V"
 * v-pointer (see also virtual) ... [20.3], [33.6]
 * v-table (see also virtual) ... [20.3], [21.4], [23.4], [33.6]
 * Value semantics ... [28], [28.7], [28.8]
 * vector<T> (see also STL) ... [10.5], [16.16], [21.4], [21.5], [32.2]
 * Version numbers to the "language" ... [33.9]
 * virtual
   - Binary compatibility of virtual functions ... [33.6]
   - Calling virtual functions from constructors ... [23.1]
   - Calling virtual functions from destructors ... [23.1]
   - Inlining virtual functions ... [28.5], [28.6]
   - Pure virtual functions ... [22.3], [22.4]
   - Redefining non-virtual member functions ... [23.2]
   - v-pointer (virtual pointer) ... [20.3], [33.6]
   - v-table (virtual table) ... [20.3], [21.4], [23.4], [33.6]
   - Virtual Constructor Idiom ... [16.20], [20.5], [22.5]
   - virtual data ... [28.2], [28.3]
   - virtual destructor coding standard ... [20.4], [25.7]
   - Virtual Friend Function Idiom ... [14.3], [15.6]
   - virtual functions ... [20]
   - virtual functions are central to OO ... [6.8]
   - virtual functions let old code call new code ... [6.9]
   - virtual functions, purpose of ... [20.1]
   - virtual inheritance ... [11.12], [29.8], [29.9], [33.6], [33.9]
 * Visual Basic vs. C++ ... [6.4]

"W"
 * Wars ... [25.1]
 * WWW sites of this document ... [2.1]

"X"
 * X3 Secretariat ... [6.12]

"Y"
 * Yaccable grammar ... [33.8]

"Z"
 * .zip (see Downloading) ... [2.2]
 * Zombie objects ... [17.1]

==============================================================================

SECTION [1]: Copying permissions


[1.1] Author

Marshall Cline, cline@parashift.com
Paradigm Shift, Inc.
One Park St.
Norwood, NY 13668
315-353-6100 (voice)
315-353-6110 (fax)

==============================================================================

[1.2] Copyright Notice

The entire C++ FAQs Lite document is Copyright (C) 1991-96 Marshall P. Cline,
Ph.D., cline@parashift.com.  All rights reserved.  Copying is permitted only
under designated situations[1.5].

==============================================================================

[1.3] No Warranty

THIS WORK IS PROVIDED ON AN "AS IS" BASIS.  THE AUTHOR PROVIDES NO WARRANTY
WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK, INCLUDING WARRANTIES
WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.

==============================================================================

[1.4] C++-FAQs-Lite != C++-FAQs-Book

This document, C++ FAQs Lite, is not the same as the C++ FAQs Book.  The book
(C++ FAQs, Cline and Lomow, Addison-Wesley) is 500% larger than this document,
and is available in bookstores.  See [3] for details.

==============================================================================

[1.5] Copying Permissions

If all you want to do is quote a small portion of C++ FAQs Lite (such as one or
two FAQs) in a larger document, simply attribute the quoted portion with
something vaguely similar to, "From Marshall Cline's C++ FAQs Lite document."
Please include the URL if it's in some printed (vs. on-line) form.  Real easy.

If you want to copy and/or distribute the entire C++ FAQs Lite document
verbatim and unchanged, all you have to do is send me a note,
cline@parashift.com, telling me about it (mainly because I'm such a curious
guy, and I want to know about the great things you're doing with this stuff!).
Also easy.

If you want to copy and/or distribute large portions of C++ FAQs Lite, that's
OK under the following conditions: (1) Include as many FAQs as you want, but if
you include any part of a FAQ, include that entire FAQ verbatim and unchanged
(i.e., don't include just a piece of any given FAQ, and don't change any of the
information you include).  (2) Retain the Author[1.1], Copyright Notice[1.2],
No Warranty[1.3], C++-FAQs-Lite != C++-FAQs-Book[1.4], and Copying
Permissions[1.5] items, and display these items conspicuously.  (3) Send me a
note, cline@parashift.com, telling me about your use of information (again,
simply because I'm curious to know about the great things you're doing with
this stuff!).

If you want more and/or different privileges than are outlined here, please
contact me, cline@parashift.com.  I'm a very reasonable man...

==============================================================================

SECTION [2]: On-line sites that distribute this document


[2.1] Where's the closest mirror site to access this document?

You'll get better response time by choosing a close site:
 * USA: http://www.cerfnet.com/~mpcline/C++-FAQs-Lite/
 * USA-2: http://vpihe1.phys.vt.edu/~lockhart/computer/cpp/index.html
 * U.K.: http://www.cs.bham.ac.uk/~jdm/CPP/index.html
 * Germany: http://www.informatik.uni-konstanz.de/~kuehl/cpp/cppfaq.htm
 * Finland: http://www.utu.fi/~sisasa/oasis/cppfaq/
 * Taiwan: http://www.cis.nctu.edu.tw/c++/C++FAQ-English/

==============================================================================

[2.2] Where can I download a .tar.Z or a .zip that contains all the HTML files
      of this on-line document? [NEW!]

[Recently created (on 11/96).]

You can't.  Not yet, at least.  And in the mean time, please don't send me
e-mail asking me to send you a copy!

Here's the scoop: I plan on giving you a one-button "send me the whole FAQ via
e-mail" option, but first I need to convince my ISP to enable some techie
things on my account.  It's going to take a while.  But in the mean time, the
best I can suggest is to use the "Save As" feature on your web browser to save
each HTML page individually.  Yes, I know that's a pain and you'd rather I sent
you the whole thing via e-mail.  But there are thousands of you and only one of
me, so please don't send me e-mail asking me to send you a copy!

One more thing that I may not have mentioned: PLEASE don't send me e-mail
asking me to send you a copy!

Oh yea, just in case I forgot to say this, PLEASE DON'T SEND ME E-MAIL ASKING
ME TO SEND YOU A COPY!

==============================================================================

[2.3] Where can I download a raw text version of this on-line document?

The "raw text" version of this on-line document is mechanically produced by
stripping the HTML tags and other goodies from the Web site.  Therefore the
"raw text" version isn't as pretty to look at, but it has basically the same
information.  Naturally the raw text version loses the hyper-linked cross
references.

Here's how you can get a copy of the "raw text" version:
 * Read comp.lang.c++ where it is posted monthly
 * Download it from ftp://rtfm.mit.edu/pub/usenet-by-group/comp.lang.c++/

==============================================================================

[2.4] Where can I download a Chinese translation of this on-line document?

http://www.cis.nctu.edu.tw/c++/C++FAQ-Chinese/ contains a Chinese translation
encoded in the "Big5" code.  Note: "Big5" is a 16-bit Chinese code used mostly
in Taiwan.

==============================================================================

SECTION [3]: C++-FAQs-Book versus C++-FAQs-Lite


[3.1] Is there a C++ FAQs Book I can buy in a bookstore?

Yes.  C++ FAQs by Cline and Lomow, Addison-Wesley, 1995, ISBN 0-201-58958-3.

==============================================================================

[3.2] Is this on-line ("Lite") document the same as the C++ FAQs Book?

No!

Many people have asked about the relationship between the book and this Lite
document.  In particular, many have wondered whether this Lite document and the
book are equivalent.  They are not.

The book (C++ FAQs, Addison-Wesley, 1995) contains roughly 500% more
information than this Lite document.  For example, the book covers both a wider
variety of topics and provides deeper details and insights than this Lite
document.  The book also includes thousands of cross references, external
references, and index terms, as well as many more programming examples.

==============================================================================

[3.3] How can I download a free copy of the C++ FAQs Book?

URL: sneaker-net://your.local.bookstore/tech-section/ISBN=0-201-58958-3

In other words, the book is available in bookstores (C++ FAQs, Addison-Wesley,
1995; ISBN 0-201-58958-3).  It is not available in any on-line forum.

Note that you can get a peek at some excerpts from the book via
http://www.aw.com/cseng/authors/cline/FAQ/FAQ.html

==============================================================================

[3.4] Why would I spend good money on a book when I can download it for free?

Because you can't download the contents of the book for free.

The book and this Lite document are not the same.  The book contains 500% more
material than this Lite document.

==============================================================================

-- 
Marshall Cline, Ph.D., President, Paradigm Shift, Inc.
315-353-6100 (voice)
315-353-6110 (fax)
mailto:cline@parashift.com
