(Click here for a personal note from Marshall Cline.)
C++ FAQ
/
Section 4
/ FAQ 4.45
Section 4:
4.1
Updates for the 03/12 release?
New!
4.2
Updates for the 11/11 release?
New!
4.3
Updates for the 07/11 release?
4.4
Updates for the 05/11 release?
4.5
Updates for the 03/11 release?
4.6
Updates for the 08/10 release?
4.7
Updates for the 06/10 release?
4.8
Updates for the 05/10 release?
4.9
Updates for the 04/10 release?
4.10
Updates for the 03/10 release?
4.11
Updates for the 01/10 release?
4.12
Updates for the 09/09 release?
4.13
Updates for the 06/09 release?
4.14
Updates for the 01/09 release?
4.15
Updates for the 03/07 release?
4.16
Updates for the 09/06 release?
4.17
Updates for the 03/06 release?
4.18
Updates for the 10/05 release?
4.19
Updates for the 07/05 release?
4.20
Updates for the 06/05 release?
4.21
Updates for the 05/05 release?
4.22
Updates for the 04/05 release?
4.23
Updates for the 03/05 release?
4.24
Updates for the 02/05 release?
4.25
Updates for the 12/04 release?
4.26
Updates for the 06/04 release?
4.27
Updates for the 08/03 release?
4.28
Updates for the 06/03 release?
4.29
Updates for the 05/03 release?
4.30
Updates for the 04/03 release?
4.31
Updates for the 03/03 release?
4.32
Updates for the 02/03 release?
4.33
Updates for the 01/03 release?
4.34
Updates for the 12/02 release?
4.35
Updates for the 09/02 release?
4.36
Updates for the 06/02 release?
4.37
Updates for the 05/02 release?
4.38
Updates for the 04/02 release?
4.39
Updates for the 03/02 release?
4.40
Updates for the 08/01 release?
4.41
Updates for the 04/01 release?
4.42
Updates for the 07/00 release?
4.43
Updates for the 03/00 release?
4.44
Updates for the 01/00 release?
4.45
Updates for the 10/99 release?
4.46
Updates for the 07/99 release?
4.47
Updates for the 06/98 release?
4.48
Updates for the 05/98 release?
4.49
Updates for the 09/97 release?
4.50
Updates for the 01/97 release?
4.51
Updates for the 11/96 release?
4.52
Updates for the 10/96 release?
4.53
Updates for the 09/96 release?
4.54
Updates for the 08/96 release?
4.55
Updates for the 07/96 release?
4.56
Updates for the 06/96 release?
4.57
Updates for the 05/96 release?
4.58
Updates for the 04/96 release?
4.59
Updates for the 03/96 release?
4.60
Updates for the 09/95 release?
4.61
Updates for the 06/95 release?
4.62
Updates for the 04/95 release?
4.63
Updates for the 03/95 release?
4.64
Updates for the 01/95 release?
4.65
Updates for the 12/94 release?
4.66
Updates for the 11/94 release?
4.67
Updates for the 08/94 release?
4.68
Updates for the 08/94 release?
[4.45] What updates were made for the 10/99 release?
8 New FAQs:
[2.7] Where can I find the C++ FAQ translated into French?
(created with much thanks to translators
S. Bailliez
,
L. Bize
,
F. Clerc
,
P. Elie
and
J. Lecomte
)
[4.45] What updates were made for the 10/99 release?
(created)
[13.11] Why shouldn't my
Matrix
class's interface look like an array-of-array?
(created)
[37.1] What is the "STL"?
(created)
[39.11] How can I create two classes that both know about each other?
(created thanks to
Steve Horne
)
[39.12] What special considerations are needed when forward declarations are used with member objects?
(created thanks to
Steve Horne
)
[39.13] What special considerations are needed when forward declarations are used with inline functions?
(created thanks to
Steve Horne
)
[39.14] Why can't I put a forward-declared class in a
std::vector<>
?
(created thanks to
Steve Horne
)
38 Changed FAQs:
[6.12] Is C++ standardized?
Updated!
(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
int const*
?
(added return type to
main()
)
[18.16] Does "
Fred const* 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
)