FAQs in section [4]:
[4.1] What updates were made for the 03/06 release? New!
[Recently created (in 3/06). Click here to go to the next FAQ in the "chain" of recent changes.]
2 New FAQs:
8 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.2] What updates were made for the 10/05 release? New!
[Recently created (in 10/05). Click here to go to the next FAQ in the "chain" of recent changes.]
9 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.3] What updates were made for the 07/05 release?
1 New FAQs:
3 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.4] What updates were made for the 06/05 release?
2 New FAQs:
7 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.5] What updates were made for the 05/05 release?
Generic changes:
- Reworked the lists of mirror sites and translations on the opening page.
4 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.6] What updates were made for the 04/05 release?
5 New FAQs:
18 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.7] What updates were made for the 03/05 release?
9 New FAQs:
23 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.8] What updates were made for the 02/05 release?
Generic changes:
6 New FAQs:
23 Changed FAQs:
- [5.9] Which newsgroup should I post my questions?
(added a link to TechiWarehouse thanks to Adam Fisher)
- [9.3] Do inline functions improve performance?
(added two bullets on cache misses thanks to a suggestion from Tom Brown)
- [10.6] Should my constructors use "initialization lists" or "assignment"?
(added an "or when" and a cross reference to the last paragraph, plus fixed some grammar, thanks to Padmanabhan V. Karthic)
- [10.8] What is the "Named Constructor Idiom"?
(added the last paragraph to discuss the return-by-value optimization thanks to a question from Can Isin)
- [10.18] What is the "Named Parameter Idiom"?
(changed friend File; to friend class File; thanks to Mehri and Padmanabhan V. Karthic)
- [10.19] Why am I getting an error after declaring a Foo object via Foo x(Bar())?
(added the alternate syntax Foo x = Bar(); thanks to a suggestion from Mike Dunn)
- [13.13] Should I design my classes from the outside (interfaces first) or from the inside (data first)?
(changed friend LinkedList; to friend class LinkedList;, and similarly with LinkedListIterator, thanks to Padmanabhan V. Karthic)
- [16.19] What's another way to build a Matrix template?
(added some pros/cons (mostly pros) thanks to a suggestion from Padmanabhan V. Karthic)
- [16.22] How do I do simple reference counting?
(changed friend FredPtr; to friend class FredPtr; thanks to Padmanabhan V. Karthic)
- [16.24] How do I provide reference counting with copy-on-write semantics for a hierarchy of classes?
(changed friend Fred; to friend class Fred; thanks to Padmanabhan V. Karthic)
- [17.7] What should I catch?
(fixed a grammatical error thanks to Padmanabhan V. Karthic)
- [17.12] Exception handling seems to make my life more difficult; clearly I'm not the problem, am I??
(rewrote the last bullet thanks to a critique of the old wording from Jan Ploski)
- [18.15] Why does the compiler allow me to change an int after I've pointed at it with a const int*?
(initialized variable x in main() thanks to Yechiel Kimchi )
- [27.13] Are there any other sources of coding standards?
(hoisted the Sutter/Alexandrescu book out to its proper, primary place; also added (thanks to Kevlin Henney) links to and insights about Elemtel and Industrial Strength C++)
- [29.5] What are the criteria for choosing between short / int / long data types?
(added the disclaimer that <stdint.h> is not part of the C++ standard and might not be supplied by your compiler vendor thanks to Padmanabhan V. Karthic)
- [29.19] What is the type of an enumeration such as enum Color? Is it of type int?
(fixed a typo thanks to Surendra Phadke and Brandon Forehand)
- [30.5] What are the practical consequences of differences in Smalltalk/C++ inheritance?
(fixed the spelling of Maserati thanks to Alessandro/Gruppo Visione)
- [33.2] How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?
(fixed a grammatical error thanks to Padmanabhan V. Karthic)
- [33.5] How can I avoid syntax errors when calling a member function using a pointer-to-member-function?
(added return value (int ans = ...) to make the sample-code more illustrative thanks to Pete Brunet)
- [33.10] What the heck is a functionoid, and why would I use one?
(added a virtual dtor thanks to Marcus; added parameters to doit() thanks to Dirk Bonekaemper; made the dtor pure virtual as an optimization)
- [35.18] Why am I getting errors when my template-derived-class accesses something it inherited from its template-base-class?
(added public: thanks to Alexander Kamotsky and Leonard "SoulSkorpion" Frankel and Stefan Näwe; fixed a grammatical error thanks to Val Kartchner)
- [39.4] What should be done with macros that contain if?
(clarified why we use the (void)0 part thanks to a suggestion from Padmanabhan V. Karthic)
- [40.1] How can I generate HTML documentation for my classes? Does C++ have anything similar to javadoc?
(updated the link to www.robertnz.net/cpp_site.html#Documentation thanks to Robert Davies and Peter Kammer)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.9] What updates were made for the 12/04 release?
Generic changes:
- In an attempt to stem the inexorable tide of spam, I've obfuscated the
email address of anyone who's contributed to the FAQ. The email addresses are
easy to decode, e.g., (NOSPAM)marshall(DASH)cline(AT)parashift(DOT)com
becomes marshall-cline@parashift.com, though hopefully the spam-bots
won't bother (yea right).
3 New FAQs:
9 Changed FAQs:
- [2.2] What happened to the one-click-download option?
(added request to stop emailing me requests to send it manually)
- [5.2] How do I get other people to do my homework problem for me?
(duplicated the "Jack Klein" attribution that was in the recent changes section thanks to Daryle Walker)
- [6.5] Is C++ better than Ada? (or Visual Basic, C, FORTRAN, Pascal, Smalltalk, or any other language?)
(fixed a spelling error thanks to Gerriet Backer)
- [21.8] But I have a Ph.D. in Mathematics, and I'm sure a Circle is a kind of an Ellipse! Does this mean Marshall Cline is stupid? Or that C++ is stupid? Or that OO is stupid?
(added the paragraph on constant Ellipses thanks to Luke Palmer)
- [23.9] What's the meaning of, Warning: Derived::f(char) hides Base::f(double)?
(included a new example, changed the parameter types so the behavior seems more bizarre/ominous, and added a note about warnings not being standardized, thanks to Daniel Kabs)
- [25.3] So there are times when multiple inheritance isn't bad?!??
(fixed a typo thanks to Sumit Rajan)
- [27.1] What are some good C++ coding standards?
(added last few sentences on the Sutter/Alexandrescu book)
- [27.13] Are there any other sources of coding standards?
(added a bullet on the Sutter/Alexandrescu book)
- [28.4] Should I buy one book, or several?
(added last few sentences recommending purchase of a coding-standards book)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.10] What updates were made for the 06/04 release?
Polish translation:
16 New FAQs:
32 Changed FAQs:
- [2.4] Where can I find the C++ FAQ Lite translated into Chinese?
(updated the URL for the GB-encoded translation thanks to Imron Alston)
- [6.5] Is C++ better than Ada? (or Visual Basic, C, FORTRAN, Pascal, Smalltalk, or any other language?)
(added to the last paragraph to make it stronger(!!))
- [6.13] Where can I get a copy of the ANSI/ISO C++ standard?
(rewrote from scratch, thanks to comments and corrections from Petter Häggholm, Lars Christensen, Pieter Van Dyck and Jim Fischer)
- [6.15] What does the FAQ mean by "such and such is evil"?
(changed "such-in-such" to "such and such" thanks to Darren Frith and Simon OLeary)
- [8.4] What does object.method1().method2() mean?
(removed a couple superfluous ")"s)
- [10.3] Can one constructor of a class call another constructor of the same class to initialize the this object?
(added a strong statement against using placement new in this situation thanks to questions from Marc Page and Steve Peters)
- [10.6] Should my constructors use "initialization lists" or "assignment"?
(fixed a (subtle!) miswording in the second paragraph thanks to Tomek Bywalec, Bartek Krzemien and Tian Yu; added the stuff on exceptions (see last paragraph) thanks to Alf Steinbach)
- [10.18] What is the "Named Parameter Idiom"?
(added a bunch more example code and clarified the explanation of class OpenFile thanks to Tomek Bywalec and Bartek Krzemien)
- [12.1] What is "self assignment"?
(fixed an error in the code-comments thanks to Jonathan Mcdougall)
- [13.10] How do I create a subscript operator for a Matrix class?
(fixed a typo thanks to Doug Schwartz)
- [15.1] Why should I use <iostream> instead of the traditional <cstdio>?
(removed a superfluous ")")
- [15.9] But shouldn't I always use a printOn() method rather than a friend function?
(removed a superfluous ")")
- [15.17] How can I tell {if a key, which key} was pressed before the user presses the ENTER key?
(updated the URL thanks to Sampath Patnala)
- [15.18] How can I make it so keys pressed by users are not echoed on the screen?
(fixed the title thanks to Todd Catelotti)
- [16.6] Do I need to check for NULL after p = new Fred()?
(added a caveat for MSVC++ thanks to Graham Knap)
- [20.8] What is a "virtual constructor"?
(rewrote the last paragraph for clarity)
- [21.2] Converting Derived* → Base* works OK; why doesn't Derived** → Base** work?
(fixed a grammatical error thanks to Philip S Tellis)
- [22.5] How do you define a copy constructor or assignment operator for a class that contains a pointer to a (abstract) base class?
(added a "contract" to the Fred ctor thanks to Bo Majewski; changed the return types in the derived classes to exploit covariant return types thanks to Dan Raviv)
- [23.11] How can I set up my class so it won't be inherited from?
(fixed a bug in the friend declaration, renamed the classes to Fred and FredBase, and general wordsmithing)
- [28.7] What are some best-of-breed C++ programming-by-example guides?
(added details about Musser and Saini thanks to Randy Sherman)
- [29.5] What are the criteria for choosing between short / int / long data types?
(added stuff about <stdint.h> thanks to Oliver Kellogg)
- [29.19] What is the type of an enumeration such as enum Color? Is it of type int?
(added the caveat about converting only valid integers to enumerations thanks to Mike Radford)
- [33.2] How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?
(added caveat about using extern "C" non-member function thanks to Rolf Magnus)
- [33.4] Why am I having trouble taking the address of a C++ function?
(rewrote the opening paragraph to give a better explanation of the "short answer")
- [35.13] How can I avoid linker errors with my template functions?
(added a note about the export keyword thanks to Greg Comeau)
- [35.15] How can I avoid linker errors with my template classes?
(added a note about the export keyword thanks to Greg Comeau)
- [35.16] Why do I get linker errors when I use template friends?
(added the required <> within the friend declaration thanks to Christophe Barbe; added the "define it within the class body" approach thanks to Frode Angell-Petersen AKA Sprudling)
- [36.10] How do I serialize objects that contain pointers to other objects, but those pointers form a tree with no cycles and only "trivial" joins?
(fixed some spelling errors thanks to Steve Fallows)
- [38.13] Is it possible to convert C++ to C?
(added LLVM thanks to Chris Sabre)
- [39.4] What should be done with macros that contain if?
(modified the primary solution to include (void)0, and thanks to Erik Haugen and Mike Morearty, added some pros/cons commentary to the secondary solution; plus did some general wordsmithing)
- [39.5] What should be done with macros that have multiple lines?
(modified the primary solution to include (void)0, and thanks to Erik Haugen and Mike Morearty, added some pros/cons commentary to the secondary solution; plus did some general wordsmithing)
- [39.7] Why can't the compiler find my header file in #include "c:\test.h" ?
(softened the wording to reflect the difference between header-names and string-literals thanks to Michiel Salters)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.11] What updates were made for the 08/03 release?
1 New FAQs:
10 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.12] What updates were made for the 06/03 release?
2 New FAQs:
13 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.13] What updates were made for the 05/03 release?
1 New FAQs:
5 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.14] What updates were made for the 04/03 release?
1 New FAQs:
13 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.15] What updates were made for the 03/03 release?
1 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.16] What updates were made for the 02/03 release?
4 New FAQs:
12 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.17] What updates were made for the 01/03 release?
9 New FAQs:
16 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.18] What updates were made for the 12/02 release?
Big-picture changes:
34 New FAQs:
- [4.18] What updates were made for the 12/02 release?
- [13.14] How can I overload the prefix and postfix forms of operators ++ and --?
(thanks to Sandeep Grover)
- [13.15] Which is more efficient: i++ or ++i?
- [15.12] How can I open a stream in binary mode?
(thanks to Simon Barner)
- [15.14] How can I write/read objects of my class to/from a data file?
- [15.15] How can I send objects of my class to another computer (e.g., via a socket, TCP/IP, FTP, email, a wireless link, etc.)?
- [19.8] I've been told to never use protected data, and instead to always use private data with protected access functions. Is that a good rule?
(thanks to a question from Andrew Chan)
- [19.9] Okay, so exactly how should I decide whether to build a "protected interface"?
- [21.11] How could "it depend"??!? Aren't terms like "Circle" and "Ellipse" defined mathematically?
- [25.1] How is this section organized?
- [25.2] I've been told that I should never use multiple inheritance. Is that right?
- [25.3] So there are times when multiple inheritance isn't bad?!??
- [25.4] What are some disciplines for using multiple inheritance?
- [25.5] Can you provide an example that demonstrates the above guidelines?
- [25.6] Is there a simple way to visualize all these tradeoffs?
- [25.7] Can you give another example to illustrate the above disciplines?
- [25.11] What special considerations do I need to know about when I use virtual inheritance?
- [25.12] What special considerations do I need to know about when I inherit from a class that uses virtual inheritance?
- [25.13] What special considerations do I need to know about when I use a class that uses virtual inheritance?
- [25.14] One more time: what is the exact order of constructors in a multiple and/or virtual inheritance situation?
(thanks to Carl Daniel)
- [33.7] Can I convert a pointer-to-member-function to a void*?
- [33.8] Can I convert a pointer-to-function to a void*?
- [35.13] How can I avoid linker errors with my template functions?
(thanks to a suggestion by Michael Kochetkov)
- [35.15] How can I avoid linker errors with my template classes?
(thanks to a suggestion by Michael Kochetkov)
- [36.1] What's this "serialization" thing all about?
(thanks to a question from Stephen Tashiro)
- [36.2] How do I select the best serialization technique?
- [36.7] How do I serialize objects that aren't part of an inheritance hierarchy and that don't contain pointers to other objects?
- [36.8] How do I serialize objects that are part of an inheritance hierarchy and that don't contain pointers to other objects?
- [36.9] How do I serialize objects that contain pointers to other objects, but those pointers form a tree with no cycles and no joins?
- [36.10] How do I serialize objects that contain pointers to other objects, but those pointers form a tree with no cycles and only "trivial" joins?
- [36.11] How do I serialize objects that contain pointers to other objects, and those pointers form a graph that might have cycles or non-trivial joins?
(thanks to a question from Stephen Tashiro)
- [36.12] Are there any caveats when serializing / unserializing objects?
- [36.13] What's all this about graphs, trees, nodes, cycles, joins, and joins at the leaves vs. internal nodes?
- [39.3] Can I templatize the above functions so they work with other types?
(inspired by Merlyn Morgan-Graham)
20 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.19] What updates were made for the 09/02 release?
Big-picture changes:
- Hyperlinks now have "hover text" text that most browsers show when
your mouse hovers over a hyperlink (though please don't write me if your
particular browser doesn't have this feature; most browsers have it but some
do not).
- Added a new mirror site in
Poland.
- Made things easier to find by adding lots more index-terms to
the permuted subject index.
9 New FAQs:
31 Changed FAQs:
- [2.4] Where can I find the C++ FAQ Lite translated into Chinese?
(updated the URL for the Big5 encoding)
- [5.1] What does IMHO mean? (or IMO, IMNSHO, FWIW, OTOH, etc.)?
(added PMFJI)
- [5.4] How can I find out about general netiquette so I don't embarrass myself?
(added admonitions against top-posting, HTML/rich-text postings, attachments, "C/C++," and confusing classes with objects; also removed "include a valid email address")
- [6.9] Are virtual functions (dynamic binding) central to OO/C++?
(minor clarifications)
- [6.14] What are some "interview questions" I could ask that would let me know if candidates really know their stuff?
(fixed a spelling error thanks to Martin Linklater)
- [9.1] What's the deal with inline functions?
(rewrote, adding several new points)
- [9.3] Do inline functions improve performance?
(rewrote, added numerous new points)
- [9.5] Why should I use inline functions instead of plain old #define macros?
(wordsmithed)
- [10.3] Can one constructor of a class call another constructor of the same class to initialize the this object?
(rewrote for clarification thanks to Nikolai Borissov)
- [10.4] Is the default constructor for Fred always Fred::Fred()?
(partially rewrote for clarity)
- [11.6] What if I want a local to "die" before the close } of the scope in which it was created? Can I call a destructor on a local if I really want to?
(wordsmithed)
- [17.4] How should I handle resources if my constructors may throw exceptions?
(added the example and the admonition to use a typedef)
- [17.5] How do I change the string-length of an array of char to prevent memory leaks even if/when someone throws an exception?
(rewrote to clarify/strengthen)
- [18.8] What does "Fred const& x" mean?
(rewrote to address the "guru approach")
- [20.7] When should my destructor be virtual?
(rewrote)
- [21.3] Is a parking-lot-of-Car a kind-of parking-lot-of-Vehicle?
(strengthened in several places)
- [21.8] But I have a Ph.D. in Mathematics, and I'm sure a Circle is a kind of an Ellipse! Does this mean Marshall Cline is stupid? Or that C++ is stupid? Or that OO is stupid?
(fixed typo in first paragraph thanks to Jim Fischer)
- [21.12] If SortedList has exactly the same public interface as List, is SortedList a kind-of List?
(strengthened the wording in a few places)
- [23.5] When my base class's constructor calls a virtual function on its this object, why doesn't my derived class's override of that virtual function get invoked?
(rewrote completely and added an example program)
- [23.8] Should a derived class redefine ("override") a member function that is non-virtual in a base class?
(reworded the question clarification)
- [23.9] What's the meaning of, Warning: Derived::f(char) hides Base::f(double)?
(changed typo f(double) to f(float) thanks to Tarjei Knapstad)
- [26.9] When initializing static data members of built-in / intrinsic / primitive types, should I worry about the "static initialization order fiasco"?
(reworded thanks to Orjan Petersson)
- [29.2] Where do I start? Why do I feel so confused, so stupid?
(added sites for "sample problems")
- [29.16] Why is floating point so inaccurate? Why doesn't this print 0.43?
(moved from the Miscellaneous Technical Issues section)
- [29.17] Why doesn't my floating-point comparison work?
(added links to David Goldberg's paper and to Doug Priest's supplement thanks to Kevin Quitt; added a definition for isEqual(double,double) thanks to Steve Summit; moved from the Miscellaneous Technical Issues section)
- [32.5] How can I call a non-system C function f(int,char,float) from my C++ code?
(changed "C code" to "C++ code" in the first sentence thanks to Sreenivas Sunil Penumarthy)
- [33.5] How can I avoid syntax errors when calling a member function using a pointer-to-member-function?
(made it clearer there is an and between the recommended typedef and macro)
- [33.6] How do I create and use an array of pointer-to-member-function?
(made it clearer there is an and between the recommended typedef and macro)
- [37.4] Where can I get help on how to use STL?
(wordsmithed for clarity)
- [37.9] Where can I get tons and tons of more information on C++ class libraries?
(added the "with frames" URL for the C++ Libraries FAQ and the comment about google, both thanks to Henrik Haraldsson)
- [40.1] How can I generate HTML documentation for my classes? Does C++ have anything similar to javadoc?
(moved from the Miscellaneous Technical Issues section)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.20] What updates were made for the 06/02 release?
Big-picture changes:
20 New FAQs:
13 Changed FAQs:
- [2.8] Where can I find the C++ FAQ Lite translated into Portuguese?
(updated the URL)
- [3.1] Is there a C++ FAQ Book in addition to the C++ FAQ Lite?
(changed the URL for the book cover and excerpts thanks to Thomas Hansen; also added the sample chapter and source code.)
- [5.6] Wait a minute, does that previous FAQ say to not answer their question just because it's already answered in the FAQ?!?
(fixed misspelling in "cripple" thanks to John Marshall plus general rewording)
- [5.13] What about spam?
(fixed a typo thanks to Paul Savage)
- [10.6] Should my constructors use "initialization lists" or "assignment"?
(added symmetry argument wrt non-static const members thanks to Tanmoy Bhattacharya)
- [10.14] Why doesn't the construct-on-first-use idiom use a static object instead of a static pointer?
(made substantive changes to the second-to-last paragraph thanks to Amitha Perera and Wil Evers)
- [18.13] What do I do if I want a const member function to make an "invisible" change to a data member?
(reworded the question to distinguish "invisible change" from "invisible data member" thanks to Thomas Hansen)
- [26.4] But, but, but what about machines where a char has more than 8 bits? Surely you're not saying a C++ byte might have more than 8 bits, are you?!?
(removed a superfluous statement)
- [26.6] I'm sooooo confused. Would you please go over the rules about bytes, chars, and characters one more time?
(rewrote; changed the example from the mythical FOO machine to a PDP-10, plus added words showing how to simulate pointers using software, much thanks to Andrew Koenig)
- [26.7] What is a "POD type"?
(added note that POD types can contain non-virtual member functions thanks to Andrew Koenig)
- [26.8] When initializing non-static data members of built-in / intrinsic / primitive types, should I use the "initialization list" or assignment?
(clarified the cross-reference)
- [26.9] When initializing static data members of built-in / intrinsic / primitive types, should I worry about the "static initialization order fiasco"?
(made it clearer that the FAQ provides a solution)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(updated the link to KAI C++)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.21] What updates were made for the 05/02 release?
Big-picture changes:
16 New FAQs:
- [4.21] What updates were made for the 05/02 release?
- [5.6] Wait a minute, does that previous FAQ say to not answer their question just because it's already answered in the FAQ?!?
- [15.17] How can I tell {if a key, which key} was pressed before the user presses the ENTER key?
(inspired by a posting by Alan Didey)
- [15.18] How can I make it so keys pressed by users are not echoed on the screen?
- [15.19] How can I move the cursor around on the screen?
- [26.1] Can sizeof(char) be 2 on some machines? For example, what about double-byte characters?
(inspired by Randy Sherman)
- [26.2] What are the units of sizeof?
(inspired by Randy Sherman)
- [26.3] Whoa, but what about machines or compilers that support multibyte characters. Are you saying that a "character" and a char might be different?!?
(inspired by Randy Sherman)
- [26.4] But, but, but what about machines where a char has more than 8 bits? Surely you're not saying a C++ byte might have more than 8 bits, are you?!?
(thanks to Randy Sherman)
- [26.5] Okay, I could imagine a machine with 9-bit bytes. But surely not 16-bit bytes or 32-bit bytes, right?
(thanks to Randy Sherman)
- [26.6] I'm sooooo confused. Would you please go over the rules about bytes, chars, and characters one more time?
(thanks to Randy Sherman)
- [26.7] What is a "POD type"?
- [26.8] When initializing non-static data members of built-in / intrinsic / primitive types, should I use the "initialization list" or assignment?
- [26.9] When initializing static data members of built-in / intrinsic / primitive types, should I worry about the "static initialization order fiasco"?
- [26.10] Can I define an operator overload that works with built-in / intrinsic / primitive types?
- [26.11] When I delete an array of some built-in / intrinsic / primitive type, why can't I just say delete a instead of delete[] a?
5 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.22] What updates were made for the 04/02 release?
3 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.23] What updates were made for the 03/02 release?
Global changes:
- Changed the HTML "anchor" scheme so it conforms to
the
standard. Thanks to Eric Anderson for pointing this out.
4 New FAQs:
27 Changed FAQs:
- [3.1] Is there a C++ FAQ Book in addition to the C++ FAQ Lite?
(changed the URL for book excerpts thanks to Chris Young)
- [5.1] What does IMHO mean? (or IMO, IMNSHO, FWIW, OTOH, etc.)?
(added OO)
- [6.11] Is C++ backward compatible with ANSI/ISO C?
(clarified the relationship between f() in C and f(...) in C++ thanks to Stefan Farfeleder)
- [6.13] Where can I get a copy of the ANSI/ISO C++ standard?
(swapped some mixed up links thanks to Randal Leistikow)
- [8.7] What is a handle to an object? Is it a pointer? Is it a reference? Is it a pointer-to-a-pointer? What is it?
(changed pointers-to-references into references-to-pointers thanks to Scott Douglass)
- [13.1] What's the deal with operator overloading?
(added comment about templates and intrinsic types thanks to Phil Hibbs)
- [15.1] Why should I use <iostream> instead of the traditional <cstdio>?
(corrected grammar of first bullet ("better type safety" ==> "more type-safe") thanks to Tristan Miller)
- [15.16] Why can't I open a file in a different directory such as "..\test.dat"?
(added an explanation as to why "/" is better than "\\" thanks to Chris Young)
- [16.3] Can I free() pointers allocated with new? Can I delete pointers allocated with malloc()?
(strengthened)
- [18.13] What do I do if I want a const member function to make an "invisible" change to a data member?
(added a caveat about this being a const Set* const thanks to Steve White)
- [20.6] I have a heterogeneous list of objects, and my code needs to do class-specific things to the objects. Seems like this ought to use dynamic binding but can't figure it out. What should I do?
(fixed typo in a typedef thanks to Salminen Kari; plus various clarifications throughout)
- [20.8] What is a "virtual constructor"?
(added parenthetical recommendation about slicing thanks to Jesse Jones)
- [21.2] Converting Derived* → Base* works OK; why doesn't Derived** → Base** work?
(added a paragraph near the end about using a pointer cast thanks to Steve White)
- [21.6] Is a Circle a kind-of an Ellipse?
(reworded)
- [21.7] Are there other options to the "Circle is/isnot kind-of Ellipse" dilemma?
(added words allowing Circle to be a state of Ellipse rather than a class in itself thanks to Nicholas Leippe)
- [21.8] But I have a Ph.D. in Mathematics, and I'm sure a Circle is a kind of an Ellipse! Does this mean Marshall Cline is stupid? Or that C++ is stupid? Or that OO is stupid?
(softened things up in two spots (thanks to Salminen Kari and Nicholas Leippe) and made it even more in-your-face in other spots (blame the author for this second set of changes I'm the meanie))
- [27.8] What source-file-name convention is best? foo.cpp? foo.C? foo.cc?
(rewrote/wordsmithed thanks to Michael Tiller)
- [27.13] Are there any other sources of coding standards?
(removed a dead link thanks to Phil Hibbs)
- [28.7] What are some best-of-breed C++ programming-by-example guides?
(added Musser's STL book thanks to Xavier Outhier from D2SET scientific and technology non profit association)
- [29.17] Why doesn't my floating-point comparison work?
(added new book references thanks to Alan McKenney)
- [37.2] Where can I get a copy of "STL"?
(removed dead link to Musser's STL site thanks to Xavier Outhier from D2SET scientific and technology non profit association)
- [37.4] Where can I get help on how to use STL?
(removed dead link to Musser's STL site thanks to Xavier Outhier from D2SET scientific and technology non profit association; added link to book section)
- [37.9] Where can I get tons and tons of more information on C++ class libraries?
(added the URL to www.mathtools.net/C_C__/ thanks to Ophir Herbst; also added the boost.org URL)
- [38.1] Where can I download a free C++ compiler?
(added Digital Mars to the list (thanks Walter!))
- [38.4] How can I decompile an executable program back into C++ source code?
(added caveat at the end re legitimate reasons to decompile)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(removed Symantec C++ since Symantec's web site says it is "discontinued," thanks to Richard Gill; added an annotation that the Digital Mars compiler is free, thanks to Walter Bright; and added the URL to the Cygwin-compiled version of GCC, thanks to Wouter Demuynck)
- [40.3] Are there any pretty-printers that reformat C++ source code?
(added "Source Styler for C++" thanks to Alison Boyce)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.24] What updates were made for the 08/01 release?
New features:
13 New FAQs:
24 Changed FAQs:
- [2.1] Where's the closest mirror site to access this document?
(removed the Finland mirror site it wasn't being kept up-to-date)
- [2.4] Where can I find the C++ FAQ Lite translated into Chinese?
(added the URL for the GB-encoded version thanks to Shen Min for the translation)
- [10.6] Should my constructors use "initialization lists" or "assignment"?
(reworded various things thanks to Stan Brown)
- [10.7] Should you use the this pointer in the constructor?
(wordsmithed thanks to Stan Brown)
- [10.12] What's the "static initialization order fiasco"?
(closed loophole wrt built-in/intrinsic types thanks to Cyril Schmidt)
- [10.13] How do I prevent the "static initialization order fiasco"?
(closed loophole wrt built-in/intrinsic types thanks to Cyril Schmidt)
- [10.15] How do I prevent the "static initialization order fiasco" for my static data members?
(closed loophole wrt built-in/intrinsic types thanks to Cyril Schmidt)
- [10.18] What is the "Named Parameter Idiom"?
(wordsmithed and added last paragraph with inspiration from Stan Brown)
- [14.2] Do friends violate encapsulation?
(added the last paragraph with inspiration from Stan Brown)
- [14.4] What does it mean that "friendship isn't inherited, transitive, or reciprocal"?
(wordsmithed ("nor" vs. "or") thanks to Herbert Gintis)
- [16.6] Do I need to check for NULL after p = new Fred()?
(changed endl to std::endl)
- [16.25] Can you absolutely prevent people from subverting the reference counting mechanism, and if so, should you?
(wordsmithed thanks to Stan Brown)
- [16.26] Can I use a garbage collector in C++?
(added cross-references thanks to Stan Brown)
- [16.27] What are the two kinds of garbage collectors for C++?
(added a URL for Attardi and Flagella's CMM thanks to Markus Laker)
- [19.7] How can I protect derived classes from breaking when I change the internal parts of the base class?
(wordsmithed thanks to Stan Brown)
- [20.8] What is a "virtual constructor"?
(added the paragraph about MS VC++ 6.0's mishandling of Covariant Return Types; thanks to Karthik for pointing this out)
- [28.4] Should I buy one book, or several?
(wordsmithed thanks to Stan Brown)
- [32.1] What do I need to know when mixing C and C++ code?
(fixed a typo thanks to Kumaran Surrendra; added the paragraph on compiling everything, even C-style code, using a C++ compiler thanks to Gary Jenkins)
- [37.2] Where can I get a copy of "STL"?
(added comment about "<string>" thanks to Stan Brown)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(added URL for Digital Mars C++ thanks to Walter Bright)
- [39.1] How do I convert a value (a number, for example) to a std::string?
(changed <stdio> to <cstdio> thanks to Stan Brown)
- [39.2] How do I convert a std::string to a number?
(changed <stdio> to <cstdio> thanks to Stan Brown)
- [39.6] What should be done with macros that need to paste two tokens together?
(removed ambivalence regarding second layer of indirection when using ## thanks to Joshua Fraser and Ronald Fischer)
- [40.2] Is there a TeX or LaTeX macro that fixes the spacing on "C++"?
(wordsmithed thanks to Stan Brown)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.25] What updates were made for the 04/01 release?
Global changes:
- Updated the opening page so it lists both the chain of recent
changes as well as the table of recent changes. This improvement is thanks to
a suggestion by John Kewley.
- Moved the main FAQ site to www.parashift.com/c++-faq-lite/. (This was unfortunately
necessary due to a business issue involving AT&T and the previous web hosting
company, Cerf-Net.)
11 New FAQs:
27 Changed FAQs:
- [5.2] How do I get other people to do my homework problem for me?
(added stuff about the evils of asking others to do your homework for you via email)
- [6.13] Where can I get a copy of the ANSI/ISO C++ standard?
(total rewrite; changed several URLs thanks to Brian K. Hamon and Garen Parham)
- [9.3] Do inline functions improve performance?
(explained "code bloat" and also added lots of if's, and's and but's)
- [10.6] Should my constructors use "initialization lists" or "assignment"?
(rewrote)
- [10.7] Should you use the this pointer in the constructor?
(rewrote because of a suggestion from Perry Rapp)
- [10.10] Why can't I initialize my static member data in my constructor's initialization list?
(added a "," in the initialization list thanks to Yaroslav Mironov)
- [14.2] Do friends violate encapsulation?
(made a bit more emphatic)
- [14.4] What does it mean that "friendship isn't inherited, transitive, or reciprocal"?
(added the "not reciprocal" item thanks to Karel Roose)
- [15.9] But shouldn't I always use a printOn() method rather than a friend function?
(fixed a bug thanks to Richard Hector)
- [16.17] But the previous FAQ's code is SOOOO tricky and error prone! Isn't there a simpler way?
(fixed the Star Trek movie number thanks to Chris Sheppard, wordsmithed last paragraph at the suggestion of Perry Rapp)
- [16.22] How do I do simple reference counting?
(moved definition of Fred::create() methods below the definition of class FredPtr)
- [16.27] What are the two kinds of garbage collectors for C++?
(added a URL for Bartlett's collector thanks to Abhishek)
- [17.2] How can I handle a constructor that fails?
(fixed typo ("its" vs. "it's") thanks to Wes Bemont)
- [24.2] How are "private inheritance" and "composition" similar?
(changed the syntax to using Engine::start; and added the sixth distinction thanks to Stan Brown; added the third similarity; added "aggregation" as another synonym; wordsmithed various parts)
- [27.1] What are some good C++ coding standards?
(fixed typo changing "where" to "were" thanks to Robert Marshall)
- [27.12] Which is better: identifier names that_look_like_this or identifier names thatLookLikeThis?
(clarified the last paragraph)
- [27.13] Are there any other sources of coding standards?
(added a new URL thanks to Christopher Lott; added www.arcticlabs.com/codingstandards/ thanks to Richard)
- [28.4] Should I buy one book, or several?
(rewrote; added the "programming by example" category)
- [31.2] What is "virtual data," and how-can / why-would I use it in C++?
(fixed the sentence just before Pros & Cons list (changed StretchableArray to StretchableStack) thanks to Harri Klapuri)
- [32.2] How can I include a standard C header file in my C++ code?
(added the whole section on "compiling C code with a C++ compiler," with inspiration thanks to Sebastian Kapfer)
- [33.6] How do I create and use an array of pointer-to-member-function?
(removed the array size from the declaration of array a, that way there's one less thing to change if someone ever adds another function-pointer to the array thanks to Serge Ansay)
- [34.1] Why should I use container classes rather than simple arrays?
(clarified "local" vs. "non-static local" thanks to Garen Parham)
- [38.1] Where can I download a free C++ compiler?
(changed to a different site since the old URL was dead thanks to Victor R. Volkman)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(fixed "Semantic" to "Symantec" and "Gary Comeau" to "Greg Comeau" thanks to Scott Tringali; fixed the URL to SGI's compiler thanks to Toon Knapen)
- [38.11] Is there a yacc-able C++ grammar?
(rewrote; added a new grammar/lexer plus a new URL for the old grammar/lexer thanks to Ed Willink)
- [40.2] Is there a TeX or LaTeX macro that fixes the spacing on "C++"?
(added a new LaTeX macro thanks to Bob Kline; rewrote)
- [40.3] Are there any pretty-printers that reformat C++ source code?
(fixed the URL for Artistic Style thanks to Claus Dahl; added A2PS thanks to Clark Dorman)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.26] What updates were made for the 07/00 release?
Global changes:
- Moved the main FAQ site to www.parashift.com/c++-faq-lite/. (This was unfortunately
necessary due to a business issue involving AT&T and the previous web hosting
company, Cerf-Net.)
12 New FAQs:
72 Changed FAQs:
- [2.4] Where can I find the C++ FAQ Lite translated into Chinese?
(updated the URL)
- [3.1] Is there a C++ FAQ Book in addition to the C++ FAQ Lite?
(added BookPool.com and AllDirect.com thanks to Stan Brown, plus reorganized)
- [3.2] Is there a big difference between C++ FAQ Lite and C++ FAQ Book?
(changed 'much' to 'many' thanks to Stan Brown)
- [6.6] Who uses C++?
(rewrote)
- [6.9] Are virtual functions (dynamic binding) central to OO/C++?
(inserted "the" before "difference" thanks to Stan Brown and reworded references to STL)
- [6.12] Is C++ standardized?
(changed "has been finalized" to "was finalized" thanks to Stan Brown)
- [6.13] Where can I get a copy of the ANSI/ISO C++ standard?
(added URLs to free copies of CD2)
- [9.5] Why should I use inline functions instead of plain old #define macros?
(rewrote the sentence on #define being evil)
- [10.5] Which constructor gets called when I create an array of Fred objects?
(changed so it uses new-style headers and the std:: syntax and reworded references to STL)
- [10.8] What is the "Named Constructor Idiom"?
(fixed a typo (Fred vs. Point) in the prose thanks to Roy LeCates)
- [12.3] OK, OK, already; I'll handle self-assignment. How do I do it?
(reworded the last paragraph)
- [13.3] What are some examples of operator overloading?
(changed so it uses the std:: syntax)
- [13.6] Can I overload operator== so it lets me compare two char[] using a string comparison?
(changed so it uses the std:: syntax)
- [13.10] How do I create a subscript operator for a Matrix class?
(changed so it uses new-style headers and the std:: syntax)
- [13.13] Should I design my classes from the outside (interfaces first) or from the inside (data first)?
(changed so it uses new-style headers and the std:: syntax and reworded references to STL)
- [15.1] Why should I use <iostream> instead of the traditional <cstdio>?
(renamed "subclassable" to "inheritable" and revamped to use new-style headers)
- [15.2] Why does my program go into an infinite loop when someone enters an invalid input character?
(changed so it uses new-style headers and the std:: syntax)
- [15.4] How does that funky while (std::cin >> foo) syntax work?
(changed so it uses new-style headers and the std:: syntax)
- [15.5] Why does my input seem to process past the end of file?
(changed so it uses new-style headers and the std:: syntax)
- [15.6] Why is my program ignoring my input request after the first iteration?
(changed so it uses new-style headers and the std:: syntax)
- [15.8] How can I provide printing for my class Fred?
(changed so it uses new-style headers and the std:: syntax)
- [15.10] How can I provide input for my class Fred?
(changed so it uses new-style headers and the std:: syntax)
- [15.11] How can I provide printing for an entire hierarchy of classes?
(changed so it uses new-style headers and the std:: syntax)
- [15.13] How can I "reopen" std::cin and std::cout in binary mode?
(changed so it uses new-style headers and the std:: syntax)
- [15.16] Why can't I open a file in a different directory such as "..\test.dat"?
(changed so it uses new-style headers and uses the std:: syntax)
- [16.6] Do I need to check for NULL after p = new Fred()?
(changed so it uses new-style headers and the std:: syntax)
- [16.7] How can I convince my (older) compiler to automatically check new to see if it returns NULL?
(changed the example to use throw rather than abort() thanks to Stan Brown; changed to use new-style headers and the std:: syntax)
- [16.14] After p = new Fred[n], how does the compiler know there are n objects to be destructed during delete[] p?
(changed "popluar" to "popular" thanks to Fabrice Clerc)
- [16.16] How do I allocate multidimensional arrays using new?
(fixed a leak in the third manipulateArray() by moving another for loop into the try block)
- [16.17] But the previous FAQ's code is SOOOO tricky and error prone! Isn't there a simpler way?
(clarified the last paragraph)
- [16.18] But the above Matrix class is specific to Fred! Isn't there a way to make it generic?
(rewrote)
- [16.20] Does C++ have arrays whose length can be specified at run-time?
(changed so it uses new-style headers and the std:: syntax and reworded references to STL)
- [16.23] How do I provide reference counting with copy-on-write semantics?
(rewrote the first paragraph for clarity thanks to Fabrice Clerc)
- [16.24] How do I provide reference counting with copy-on-write semantics for a hierarchy of classes?
(changed so it uses new-style headers and the std:: syntax)
- [17.5] How do I change the string-length of an array of char to prevent memory leaks even if/when someone throws an exception?
(rewrote the last half)
- [18.1] What is "const correctness"?
(changed so it uses new-style headers and the std:: syntax)
- [18.2] How is "const correctness" related to ordinary type safety?
(changed so it uses new-style headers and the std:: syntax)
- [18.10] What is a "const member function"?
(removed a spurious ")" thanks to Stan Brown)
- [18.15] Why does the compiler allow me to change an int after I've pointed at it with a const int*?
(changed so it uses new-style headers and the std:: syntax)
- [19.3] How do you express inheritance in C++?
(added "derived class of" to the list of synonyms)
- [19.7] How can I protect derived classes from breaking when I change the internal parts of the base class?
(renamed "subclass" to "derived class")
- [21.4] Is an array of Derived a kind-of array of Base?
(changed so it uses new-style headers and the std:: syntax and reworded references to STL)
- [21.5] Does array-of-Derived is-not-a-kind-of array-of-Base mean arrays are bad?
(changed so it uses new-style headers and the std:: syntax and reworded references to STL)
- [22.3] What is an ABC?
(renamed "subclass" to "derived class")
- [22.4] What is a "pure virtual" member function?
(renamed "subclass" to "derived class")
- [24.3] Which should I prefer: composition or private inheritance?
(changed so it uses new-style headers and the std:: syntax)
- [24.5] How is protected inheritance related to private inheritance?
(renamed "subclass" to "derived class")
- [24.6] What are the access rules with private and protected inheritance?
(renamed "subclass" to "derived class")
- [27.4] What's the difference between <xxx> and <xxx.h> headers?
(changed <xyz.h> to <xxx.h> and wordsmithed thanks to Stan Brown)
- [27.6] Is the ?: operator evil since it can be used to create unreadable code?
(changed so it uses new-style headers and the std:: syntax)
- [27.10] Are there any lint-like guidelines for C++?
(changed so it uses new-style headers and the std:: syntax)
- [27.12] Which is better: identifier names that_look_like_this or identifier names thatLookLikeThis?
(improved the precision and added the last two paragraphs thanks to Chris Hurst)
- [27.13] Are there any other sources of coding standards?
(fixed some URLs thanks to James S. Adelman and Stan Brown)
- [29.16] Why is floating point so inaccurate? Why doesn't this print 0.43?
(changed so it uses new-style headers and the std:: syntax)
- [30.4] How do you use inheritance in C++, and is that different from Smalltalk?
(renamed "subclass" to "derived class")
- [30.5] What are the practical consequences of differences in Smalltalk/C++ inheritance?
(renamed "subclass" to "derived class")
- [31.3] What's the difference between virtual data and dynamic data?
(renamed "subclass" to "derived class")
- [31.8] Does the poor performance of reference semantics mean I should pass-by-value?
(renamed "subclass" to "derived class")
- [34.2] How can I make a perl-like associative array in C++?
(changed so it uses new-style headers and the std:: syntax)
- [34.5] How can I insert/access/change elements from a linked list/hashtable/etc?
(reworded, plus changed so it uses new-style headers and the std:: syntax)
- [35.2] What's the syntax / semantics for a "class template"?
(changed so it uses new-style headers and the std:: syntax)
- [35.3] What's the syntax / semantics for a "function template"?
(changed so it uses new-style headers and the std:: syntax)
- [37.1] What is the "STL"?
(changed so it uses new-style headers and the std:: syntax)
- [37.2] Where can I get a copy of "STL"?
(added URLs for the SGI implementation and STLport thanks to Stan Brown)
- [37.3] How can I find a Fred object in an STL container of Fred* such as std::vector<Fred*>?
(changed so it uses new-style headers and the std:: syntax)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(updated the URL for IBM VisualAge C++ thanks to Rick Alther; updated the URL for GNU C++ thanks to Martin Honnen)
- [39.4] What should be done with macros that contain if?
(added the last three paragraphs, including the link showing why we don't use do {...} while (false))
- [39.5] What should be done with macros that have multiple lines?
(changed "if (1)..." to "if (true)..." and "do...while (0)" to "do...while (false)")
- [39.8] What are the C++ scoping rules for for loops?
(because the scoping rules for for loops are no longer "new" (thanks Stan Brown), rewote the FAQ)
- [39.14] Why can't I put a forward-declared class in a std::vector<>?
(changed so it uses new-style headers and the std:: syntax)
- [40.3] Are there any pretty-printers that reformat C++ source code?
(added HPS Beauty)
- [40.6] Why does my DOS C++ program says "Sorry: floating point code not linked"?
(added a cross reference and updated to new header syntax)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.27] What updates were made for the 03/00 release?
4 New FAQs:
14 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.28] What updates were made for the 01/00 release?
3 New FAQs:
16 Changed FAQs:
- [2.1] Where's the closest mirror site to access this document?
(changed the rationale for choosing a close site thanks to Stan Brown)
- [5.1] What does IMHO mean? (or IMO, IMNSHO, FWIW, OTOH, etc.)?
(added IMAO thanks to Charles R Martin)
- [5.14] How do I get the FAQs for a particular newsgroup?
(added www.faqs.org thanks to Dan Kegel)
- [6.9] Are virtual functions (dynamic binding) central to OO/C++?
(reworded the second paragraph thanks to Stan Brown)
- [6.12] Is C++ standardized?
(changed "American National Standards Organization" to "American National Standards Institute" thanks to Mark Jones; also reworded first paragraph thanks to Stan Brown)
- [12.1] What is "self assignment"?
(changed "knowning" to "knowing" thanks to Stan Brown)
- [12.3] OK, OK, already; I'll handle self-assignment. How do I do it?
(reworded the last paragraph thanks to Stan Brown)
- [13.5] What operators can/cannot be overloaded?
(got rid of #if/#else/#endif by splitting the example thanks to Stan Brown)
- [15.16] Why can't I open a file in a different directory such as "..\test.dat"?
(added an explanation that the library routines treat "/" and "\" interchangeably thanks to Stan Brown)
- [18.16] Does "const Fred* p" mean that *p can't change?
(added an indication that there might be other non-const ways to get at the object thanks to Stan Brown)
- [20.2] How can C++ achieve dynamic binding yet also static typing?
(added the definition of polymorphism thanks to Kemberli Jennings)
- [22.5] How do you define a copy constructor or assignment operator for a class that contains a pointer to a (abstract) base class?
(fixed Circle and Square so they inherit from Shape thanks to Paul Campbell)
- [33.1] Is the type of "pointer-to-member-function" different from "pointer-to-function"?
(changed "It's type is..." to "Its type is..." thanks to Graham Borland)
- [34.5] How can I insert/access/change elements from a linked list/hashtable/etc?
(reworded first 4 paragraphs thanks to Stan Brown)
- [38.2] Where can I get more information on using MFC and Visual C++?
(updated the URL thanks to Katy Mulvey; changed the maintainer's name thanks to AllanW)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(changed the URL for Watcom C++ thanks to Stephen Howe; added Comeau C++ thanks to Greg Comeau)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.29] What updates were made for the 10/99 release?
8 New FAQs:
38 Changed FAQs:
- [6.12] Is C++ standardized?
(changed "International Standards Organization" to "International Organization for Standardization" thanks to (NOSPAM)savvysoft2(AT)aol(DOT)com)
- [7.1] What is a class?
(cleaned up wording so no one thinks int is a class thanks to Ron Natalie)
- [8.1] What is a reference?
(added return type to main())
- [8.2] What happens if you assign to a reference?
(inserted "state of the" to avoid ambiguity thanks to Donna)
- [8.3] What happens if you return a reference?
(added return type to main())
- [10.5] Which constructor gets called when I create an array of Fred objects?
(added return type to main(), plus added stuff about "explicit initialization of arrays" thanks to Keller Beyer)
- [10.8] What is the "Named Constructor Idiom"?
(added return type to main())
- [12.1] What is "self assignment"?
(added return type to main())
- [13.4] But operator overloading makes my class look ugly; isn't it supposed to make my code clearer?
(added return type to main())
- [13.5] What operators can/cannot be overloaded?
(added return type to main())
- [13.6] Can I overload operator== so it lets me compare two char[] using a string comparison?
(replaced "class type" with "user-defined type" in first paragraph thanks to Daryle Walker)
- [13.10] How do I create a subscript operator for a Matrix class?
(added return type to main(); added parameters to the instantiation of m in main() thanks to Boris Pulatov)
- [13.13] Should I design my classes from the outside (interfaces first) or from the inside (data first)?
(added an admonition to not "roll your own" container classes)
- [15.2] Why does my program go into an infinite loop when someone enters an invalid input character?
(added return type to main())
- [15.5] Why does my input seem to process past the end of file?
(strengthened the message with another example)
- [15.8] How can I provide printing for my class Fred?
(added return type to main())
- [15.10] How can I provide input for my class Fred?
(added return type to main())
- [15.16] Why can't I open a file in a different directory such as "..\test.dat"?
(added return type to main())
- [16.7] How can I convince my (older) compiler to automatically check new to see if it returns NULL?
(added return type to main())
- [16.21] How can I force objects of my class to always be created via new rather than as locals or global/static objects?
(added return type to main())
- [18.15] Why does the compiler allow me to change an int after I've pointed at it with a const int*?
(added return type to main())
- [18.16] Does "const Fred* p" mean that *p can't change?
(added return type to main())
- [21.2] Converting Derived* → Base* works OK; why doesn't Derived** → Base** work?
(added return type to main(); added methods openGasCap() and fireNuclearMissle() makes the example more exciting)
- [21.4] Is an array of Derived a kind-of array of Base?
(added return type to main())
- [24.4] Should I pointer-cast from a private derived class to its base class?
(changed PrivateDer to PrivatelyDer in last paragraph)
- [24.6] What are the access rules with private and protected inheritance?
(rewritten with the using syntax; thanks to Stephen Vance)
- [29.16] Why is floating point so inaccurate? Why doesn't this print 0.43?
(added return type to main())
- [32.2] How can I include a standard C header file in my C++ code?
(added return type to main())
- [32.3] How can I include a non-system C header file in my C++ code?
(added return type to main())
- [32.4] How can I modify my own C header files so it's easier to #include them in C++ code?
(added return type to main())
- [32.5] How can I call a non-system C function f(int,char,float) from my C++ code?
(added return type to main())
- [33.2] How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?
(added return type to main())
- [34.2] How can I make a perl-like associative array in C++?
(added return type to main())
- [35.2] What's the syntax / semantics for a "class template"?
(added return type to main())
- [35.3] What's the syntax / semantics for a "function template"?
(added return type to main())
- [38.1] Where can I download a free C++ compiler?
(fixed the URL)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(added Edison Design Group C++ thanks to Matt Page)
- [40.3] Are there any pretty-printers that reformat C++ source code?
(added Artistic Style thanks to Philipp Berndt, fixed the URL for C++2LaTeX thanks to Vinay Kumar Nallamothu, fixed the URL for C-Clearly thanks to Bill Robertson; fixed the plaintext version (the "grind" definition didn't show up there) thanks to Nimrod Zimerman)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.30] What updates were made for the 07/99 release?
2 New FAQs:
22 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.31] What updates were made for the 06/98 release?
2 New FAQs:
1 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.32] What updates were made for the 05/98 release?
Global changes:
- Removed the grey background color on the HTML version. It now
displays in the Web Browser's own preferences.
5 New FAQs:
9 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.33] What updates were made for the 09/97 release?
5 New FAQs:
8 Changed FAQs:
- [1.3] Copying Permissions
(clarified)
- [5.1] What does IMHO mean? (or IMO, IMNSHO, FWIW, OTOH, etc.)?
(added silly acronym-laden comment at the bottom (adapted from e-mail from Erik Corry)
- [16.17] But the previous FAQ's code is SOOOO tricky and error prone! Isn't there a simpler way?
(fixed some inconsistencies between FredMatrix and Matrix thanks to Jeff Baker)
- [16.22] How do I do simple reference counting?
(fixed FredPtr's constructor thanks to Chichiang Wan)
- [23.9] What's the meaning of, Warning: Derived::f(char) hides Base::f(double)?
(rewritten with the using syntax; thanks to Matt Seitz)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(corrected the URL for Symantec C++ thanks to Michel Joly de Lotbiniere and added the URL for HP C++ thanks to David Green)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(corrected the URL for Microsoft Visual C++ thanks to Leila Rannanjarvi, and added the URL for Sun C++ thanks to Aryan Mirsepassi)
- [40.3] Are there any pretty-printers that reformat C++ source code?
(added information about tgrind)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.34] What updates were made for the 01/97 release?
Global changes:
- Added the (much requested!) one-click download
feature. This automagically sends you a copy of the entire FAQ so you
can browse off-line. There's a similar feature to get
a copy of the "plaintext" version of the FAQ.
- Removed those pesky "hit counters" from each HTML page.
- Added nifty forward and backward links just after each
FAQ.
- Added more nifty navigation aids at the bottom of each
page.
- Renamed section [6]
from "Management Issues" to "Big Picture Issues."
5 New FAQs:
16 Changed FAQs:
- [1.3] Copying Permissions
(simplified)
- [2.1] Where's the closest mirror site to access this document?
(removed the "USA-2" site)
- [2.2] What happened to the one-click-download option?
(rewrote and added a one-click feature to get .zip, .tar.Z or .tar.gz format)
- [5.1] What does IMHO mean? (or IMO, IMNSHO, FWIW, OTOH, etc.)?
(added KUTGW (thanks to Bengt Richter))
- [15.8] How can I provide printing for my class Fred?
(added note about cascading operator<< calls)
- [15.10] How can I provide input for my class Fred?
(added note about cascading operator<< calls)
- [16.7] How can I convince my (older) compiler to automatically check new to see if it returns NULL?
(fixed bugs: new handlers don't take arguments, thanks to Scott Aaron; changed set_new_hanlder to set_new_handler, thanks to Peter Andersson)
- [16.16] How do I allocate multidimensional arrays using new?
(rewritten and expanded with a rectangular-matrix case)
- [18.1] What is "const correctness"?
(rewrote because of helpful feedback from Nor Jaidi)
- [21.6] Is a Circle a kind-of an Ellipse?
(added a caveat that setSize(x,y) isn't sacred)
- [21.7] Are there other options to the "Circle is/isnot kind-of Ellipse" dilemma?
(added a caveat that setSize(x,y) isn't sacred)
- [21.8] But I have a Ph.D. in Mathematics, and I'm sure a Circle is a kind of an Ellipse! Does this mean Marshall Cline is stupid? Or that C++ is stupid? Or that OO is stupid?
(added a caveat that setSize(x,y) isn't sacred)
- [23.5] When my base class's constructor calls a virtual function on its this object, why doesn't my derived class's override of that virtual function get invoked?
(rewrote)
- [32.8] How can I pass an object of a C++ class to/from a C function?
(added #ifndef FRED_H / #define FRED_H to code)
- [38.5] Where can I get information about the C++ compiler from {Borland, IBM, Microsoft, Sun, etc.}?
(added HP C++)
- [40.5] Where can I get OS-specific questions answered (e.g., BC++, Windows, etc)?
(added Borland C++ URLs thanks to Simon Edlund)
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.35] What updates were made for the 11/96 release?
4 New FAQs:
3 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.36] What updates were made for the 10/96 release?
1 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.37] What updates were made for the 09/96 release?
12 New FAQs:
11 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.38] What updates were made for the 08/96 release?
Global changes:
18 New FAQs:
12 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.39] What updates were made for the 07/96 release?
Global changes:
49 New FAQs:
13 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.40] What updates were made for the 06/96 release?
3 New FAQs:
13 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.41] What updates were made for the 05/96 release?
Updated everything. Transformed the source from raw text to HTML.
Reorganized, reworded, expanded, added example code, etc, etc.
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.42] What updates were made for the 04/96 release?
4 New FAQs:
3 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.43] What updates were made for the 03/96 release?
3 New FAQs:
9 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.44] What updates were made for the 09/95 release?
5 New FAQs:
4 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.45] What updates were made for the 06/95 release?
3 New FAQs:
2 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.46] What updates were made for the 04/95 release?
2 New FAQs:
1 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.47] What updates were made for the 03/95 release?
4 New FAQs:
1 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.48] What updates were made for the 01/95 release?
2 New FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.49] What updates were made for the 12/94 release?
3 New FAQs:
1 Changed FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.50] What updates were made for the 11/94 release?
3 New FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.51] What updates were made for the 08/94 release?
Rewrote most of the answers to provide general cleanup. Changed the quotation
marks to "..." rather than `...' and/or ``...''. Sample code lines now start
with a tab (no other lines starts with a tab). Everything was edited; minor
modifications everywhere.
3 New FAQs:
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
[4.52] What updates were made before 08/94?
This document was originally written in 1991. I have no record of the specific
changes that were made prior to 8/94.
[ Top | Bottom | Previous section | Next section | Search the FAQ ]
E-mail the author
[ C++ FAQ Lite
| Table of contents
| Subject index
| About the author
| ©
| Download your own copy ]
Revised Mar 1, 2006